Data Structure and Algorithm: Lecture No 1 Prepared by Muhammad Farhan
Data Structure and Algorithm: Lecture No 1 Prepared by Muhammad Farhan
Algorithm
Lecture No 1
Prepared by Muhammad Farhan
Text Book
• Text book
Data Structures and Algorithms By Mark Allen Weise
• Reference Book
Data structure in C++ by Muhammad Tauqeer Aikman series
Data vs. Information
Data Information
• A set of values have no • Meaningful processed data
meaning
Data vs. Information
• Data: 51007
• Information:
• 5/10/07 The date of your final exam.
Data Structure
• Data structure defines a particular way to organize a data in a computer so
that it can be used efficiently.
• Data structure are a containers which hold a data.
• Efficient mean take minimum time and minimum memory space.
• Data structures are used in almost every program
Application of Data Structure
• Data structures are widely applied in the following areas:
• Compiler design
• Operating system
• DBMS
• Artificial intelligence
Classification of Data Structure
Primitive DS Non-Primitive DS
Linear Non-Linear
• For example, to create a variable of integer type in C++, the statement is written as
:
• Int a, b;
• The above statement creates a memory space of two bytes for each variable a & b.
Algorithm
• The step by step procedure to solve a particular problem is called algorithm.
• For example
• A recipe for cooking a cake is an algorithm
Write an algorithm to print first ten numbers using REPEAT WHILE strucute
• STEP 1: START
• STEP 2: C=1
• STEP 3: REPEAT STEP 4 TO 5 WHILE (C<=10)
• STEP 4: PRINT C
• STEP 5 C=C+1 [END OF STEP-3 LOOP]
• STEP 6: EXIT