Docsity

Data Structures: Introduction to Algorithms, Arrays, Stacks, and Queues, Slides of Data Structures and Algorithms

Partial preview of the text

Download Data Structures: Introduction to Algorithms, Arrays, Stacks, and Queues and more Slides Data Structures and Algorithms in PDF only on Docsity!

Department of Computer Science

Subject Name : Data Structures

Subject Code : 33A

Class : II B.Sc. CS

Semester : III

Prepared by : Dr. Hemalatha K

Assistant Professor

Department of Computer Science

KG College of Arts and Science

UNIT - I INTRODUCTION OF ALGORITHMS, ANALYSING ALGORITHMS

UNIT I Introduction: Introduction of Algorithms, Analysing Algorithms. Arrays: Sparse Matrices

  • Representation of Arrays. Stacks and Queues. Fundamentals - Evaluation of Expression Infix to Postfix Conversion - Multiple Stacks and Queues.

INTRODUCTION Data Structure Introduction: ➢ Data Structure is a way to store and organize data so that it can be used efficiently. ➢ Data Structure includes all topics of Data Structure such as Array, Pointer, Structure, Linked List, Stack, Queue, Graph, Searching, Sorting, Programs, etc. ➢ Data structures are the building blocks of any program or the software.

File:

File is a collection of various records of one type of entity, for example,

if there are 60 employees in the class, then there will be 20 records in the

related file where each record contains the data about each employee.

Attribute and Entity:

An entity represents the class of certain objects. it contains various

attributes. Each attribute represents the particular property of that entity.

Field: Field is a single elementary unit of information representing the attribute

of an entity.

INTRODUCTION OF ALGORITHM Algorithm An algorithm is a procedure having well defined steps for solving a particular problem. Algorithm is finite set of logic or instructions, written in order for accomplish the certain predefined task. It is not the complete program or code, it is just a solution (logic) of a problem, which can be represented either as an informal description using a Flowchart or Pseudo code.

THE PERFORMANCE OF ALGORITHM IS MEASURED ON THE BASIS OF FOLLOWING PROPERTIES: Time complexity: It is a way of representing the amount of time needed by a program to run to the completion. Space complexity: It is the amount of memory space required by an algorithm, during a course of its execution. Space complexity is required in situations when limited memory is available and for the multi user system.

Specification: Description of the computational procedure. Pre-conditions: The condition(s) on input. Body of the Algorithm: A sequence of clear and unambiguous instructions Post-conditions: The condition(s) on output.

Department of Computer Science

Subject Name : Data Structures

Subject Code : 33A

Class : II B.Sc. CS

Semester : III

Prepared by : Dr.Hemalatha K

Assistant Professor

Department of Computer Science

KG College of Arts and Science

1.Requirements 2.Design a. Top Down Approach b. Bottom Up Approach 3.Analysis 4.Refinement and coding 5.Verification a. Program proving b. Testing c. Debugging HOW TO CREATE PROGRAMS 5 PHASES

procedure SORT ( A,n ) 1 for i← 1 to n d 2 j ← i 3 for k ← j + 1 to n do 4 if A(k) < A(j) then j ← k 5 end 6 t ← A(i); A(i) ← A(j); A(j) ← t 7 end 8 end SORT procedure SORT

🞂 Subroutines should be created in order to perform logical sub functions. 🞂 The coding that is done in the project should be in readable form.

.

. for i ← to n do for I ← 1 to n do for j ← 1 to n do . x← x+1 x← x+1 x← x+ end end . end . (a) (b) (c) Three simple programs for frequency counting