Data Structures

Understanding Data Structures
•Data structures are techniques for organizing and storing data in computer
memory.
•Understanding a data structure involves
–Understanding the storage pattern,
–Understanding what methods are used to create, access, and manipulate the data
structure.
• Common data structures
–Arrays
–Queues
–Stacks
–Linked Lists

Arrays
• An array is a collection of items of the same type.
• The items in an array are stored in contiguous memory locations.
• Capacity of an array is predefined and fixed.
• Any array item can be directly accessed by using an index.
• C# array indexes are zero-based.

Queues
• A collection of items in which the first item added to the collection is the first one
to be removed.
• First In First Out (FIFO).
•Queue is a heterogeneous data structure.
• Capacity of a queue is the number of items the queue can hold.
• As elements are added to the queue, the capacity can be automatically increased.

• A collection of items in which last item added to the collection is the first one to
be removed.
• Last In First Out (LIFO).
• Stack is a heterogeneous data structure.
• Capacity of a stack is the number of items the queue can hold.
• As elements are added to the stack, the capacity can be automatically increased.

Linked Lists
• A linked list is a collection of nodes arranged so that each node contains a link to
the next node in the sequence.
• Each node in a linked list contains of two pieces of information:
–the data corresponding to the node
–the link to the next node

 

 

Leave a comment