Uploaded by saeed arif

Lecture 1.1

advertisement
Data Structures
Dr. Saeed Arif Shah
Data Structures & Algorithms
•Schedule
• When
S
• oWednesday, Thurday: 11:00 – 12:30
•Venue
1
oDCS&IT, King Abdullah Campus (KAC)
2•
3 Office Hours
•0 Tuesday
•1
: 09:00AM – 10:30AM
Course Outline
• Introduction
• Data structures, Algorithms, Abstract Data Type (ADT), Complexity Analysis, Big-O
notation.
• Arrays
• One dimensional arrays and their representation in memory, searching an unsorted
array, binary search for sorted arrays, Two dimensional arrays, Multidimensional arrays
• Linked Lists
• Representation of linked list, operations on linked list, Types of linked lists, doubly linked
list, circular linked list
• Sorting Algorithms
• Quadratic Sorting (Bubble sort, selection sort, insertion sort), Logarithmic Sorting
(merge sort, quick sort)
• Recursion and analyzing recursive algorithms
Course Outline
• The Stack
• Operation performed on stacks, Stacks implementation (using arrays and linked lists),
Applications of stacks, converting infix to postfix notations, Evaluating postfix expressions.
• The Queue
• Operations on queue, dequeuer, circular queue priority queues (linked and array
implementations of queues), Applications of queues.
• The Trees
• Basic Terminologies, binary trees, binary tree representation, operations on binary tree,
traversing binary trees recursively, traversing binary tree non-recursively, binary search trees,
balanced trees.
• Graphs
• Basic terminologies, representation of graph, operations on graph, breadth first search, depth
first search, minimum spanning tree, shortest Path
• Hashing and Indexing
• General idea, hash function, separate chaining, hash tables with linked lisk, rehashing.
Recommended Books
• Text Book
• Data Structures, Algorithms And Applications In C++, By Sartaj Sahni, 2nd
Edition
• Reference Books
• Data Structures and Algorithm Analysis in C++ by Mark Allen Weiss, 4th
Edition.
• Data Structures using C++, By D. S. Malik, 2nd Edition.
• Principles of Data Structures Using C and C++ By Vinu V Das
• Schaums Outline Of Data Structures with C++ by J R Hubbard
What is Data?
oA collection of facts from which a conclusion may be
drawn
oExample:
•Temperature is 35 degrees Celsius
•Conclusion: It is HOT!
•Types of data:
oTextual: for example
• » Your name (Muhammad)
oNumeric: for example
• » Your id (090254)
oAudio: for example,
• » Your voice
What are Data Type?
• Data Type:
• Built-in construct of any programming language to manipulate “basic
types of data”
• Basic Types of Data
• Character
• Integer
• Real or Floating point number
• Example (Data Type):
• int, char, double etc ;
What are Data Structures?
• Data Structure:
• A particular way of storing and organizing data in a computer so that
it can be used efficiently
• It is a group of data elements stored together under one name
• It is also referred as “Abstract Data Type (ADT)”
• Example:
• An array of integers
• int examGrades[30];
Importance of Data Structures
• Goal:
• We need to organize data
• For what purpose?
• To facilitate efficient storage of data
• retrieval of data
• manipulation of data
• Design Issue:
• The challenge is to select the most appropriate data structure for the
problem
• Such is one of the motivations for this course
List of Data Structures
C
• Arrays
• Linked List
• Stack
• Queue
• Tree
Classification of Data Structures
• Based on Existence:
• Physical data structures
• Actually, meant for storing the data in the memory.
• Can be created independently
• Array
• Linked List
• Logical data structures
• Performing operations stored data
• Can’t be created independently
• stack, queues, trees, graphs
Classification of Data Structures
• Based on Memory Allocation:
• Static (or fixed sized) data structures
• Such as arrays
• int marks [30]
• Dynamic data structures (change size as needed)
• Such as Linked Lists
Classification of Data Structures
• Based on Representation
• Linear data structures
• Arrays
• Linked lists
• Stack
• Queues
• Non-linear data structures
• Trees
• Graphs
Operations on Data Structures
• Traversing
• Accessing/visiting each data element exactly once so that certain items in the data
may be processed
• Searching
• Finding the location of a given data element (key) in the structure
• Insertion:
• Adding a new data element to the structure
• Deletion
• Removing a data element from the structure
• Sorting
• Arrange the data elements in some logical fashion
• ascending or descending
• Merging
• Combining data elements form two or more data structures into one
Download