Data Structures
Array
An Array is a contiguous data structure and can store elements of the same type.
Character strings are represented as arrays of characters. Typically the character strings end with a NUL termination character denoted by '\0'.
Difference between NUL and NULL?
NUL stands for the ASCII character code 0.
NULL stands for macro defined in stddef for a NULL pointer.
Size of Array
Size of an array is sizeof(type_of_element) * number of elements in array.
Initialization
How do we initialize array during declaration?
Operations
Insert | O(1) |
---|---|
Delete | O(N) |
Search | O(N) |
Update | O(N) |
Linked List
A Linked list is a non-contiguous data structure and can store elements of the same type.