Docsity

C++ Code for Linked List: Adding a Node, Slides of C programming

Partial preview of the text

Download C++ Code for Linked List: Adding a Node and more Slides C programming in PDF only on Docsity!

Lecture No.

Data Structures

Data Structures

ļ‚§ (^) Prepares the students for (and is a prerequisite for) the more advanced material ļ‚§ (^) Cover well-known data structures such as dynamic arrays, linked lists, stacks, queues, tree and graphs. ļ‚§ (^) Implement data structures in C/C++

Data Structures

ļ‚§ (^) Prepares the students for (and is a prerequisite for) the more advanced material ļ‚§ (^) Cover well-known data structures such as dynamic arrays, linked lists, stacks, queues, tree and graphs. ļ‚§ (^) Implement data structures in C/C++

Grading

ļ‚§ (^) Presentation + Assignment +etc 20% ļ‚§ (^) Mid Term 30% ļ‚§ Final 50% ļ‚§ (^) Privileged Marks on basis of class interest, attitude etc 10% to 15% addition in overall

Need for Data Structures

ļ‚§ (^) Data structures organize data ļƒž more efficient programs. ļ‚§ More powerful computers ļƒž more complex applications. ļ‚§ (^) More complex applications demand more calculations.

Need for Data Structures

ļ‚§ (^) Data structures organize data ļƒž more efficient programs. ļ‚§ More powerful computers ļƒž more complex applications. ļ‚§ (^) More complex applications demand more calculations.

Organizing Data

Any organization for a collection of records that can be searched, processed in any order, or modified. ļ‚§ (^) The choice of data structure and algorithm can make the difference between a program running in a few seconds or many days.

Organizing Data

Any organization for a collection of records that can be searched, processed in any order, or modified. ļ‚§ (^) The choice of data structure and algorithm can make the difference between a program running in a few seconds or many days.

Efficiency

A solution is said to be efficient if it solves the problem within its resource constraints. ļ‚§ (^) Space ļ‚§ (^) Time ļ‚§ (^) The cost of a solution is the amount of resources that the solution consumes.

Selecting a Data Structure

Select a data structure as follows:

  1. Analyze the problem to determine the resource constraints a solution must meet.
  2. Determine the basic operations that must be supported. Quantify the resource constraints for each operation.
  3. Select the data structure that best meets these requirements.

Selecting a Data Structure

Select a data structure as follows:

  1. Analyze the problem to determine the resource constraints a solution must meet.
  2. Determine the basic operations that must be supported. Quantify the resource constraints for each operation.
  3. Select the data structure that best meets these requirements.

Some Questions to Ask

  • (^) Are all data inserted into the data structure at the beginning, or are insertions interspersed with other operations?
  • (^) Can data be deleted?
  • (^) Are all data processed in some well- defined order, or is random access allowed?

Some Questions to Ask

  • (^) Are all data inserted into the data structure at the beginning, or are insertions interspersed with other operations?
  • (^) Can data be deleted?
  • (^) Are all data processed in some well- defined order, or is random access allowed?

Data Structure Philosophy

Each data structure has costs and benefits. ļ‚§ (^) Rarely is one data structure better than another in all situations. ļ‚§ (^) A data structure requires:

  • (^) space for each data item it stores,
  • (^) time to perform each basic operation,
  • (^) programming effort.