Data Structures Using Object Oriented Programming

mallikamt 305 views 13 slides Mar 15, 2016
Slide 1
Slide 1 of 13
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13

About This Presentation

This presentation talks about data structures, how linked lists work and how to implement them using object oriented programming.


Slide Content

DATA STRUCTURES

Data Structures A way of organizing data so that it can be used efficiently. Choice of data structure determines how efficiently the program runs. Choosing a data structure depends on data operations and frequency. Each data structure requires space for storage, time for operations

Data Structure Examples - Stack

Data Structure Examples - Queue

Data Structure Examples – Linked Lists NULL DATA NEXT DATA NEXT DATA NEXT DATA

Linked List and Nodes NULL DATA NEXT DATA NEXT DATA NEXT DATA NEXT DATA A Node Object { Variable to hold data; Variable to hold next reference; } VALUE REFERENCE

Adding to a list NULL DATA NEXT DATA NEXT DATA NEXT DATA Last In First Out NULL DATA NEXT DATA NEXT DATA NEXT DATA First In Last Out ADDED FIRST ADDED LAST ADDED FIRST ADDED LAST

Adding the first node NULL DATA Create an object of type Node which contains value for data and whose next reference value is null NULL DATA FIRST 2. Store the reference to this newly created object in a variable.

Adding subsequent nodes NULL DATA Create an object of type Node which contains value for data and whose next reference value is null NEXT DATA FIRST Append this new node before or after the current node. Update the NEXT and FIRST references. NULL DATA

Inserting node NEXT DATA NEXT DATA FIRST NULL DATA NULL DATA NEXT

Removing first node NEXT DATA FIRST NEXT DATA NULL DATA FIRST

Removing specific node NEXT DATA NULL DATA CURRENT NEXT DATA NEXT DATA PREVIOUS CURRENT CURRENT PREVIOUS Match? Match? FOUND!! Match?

What we talked about Data structures and why we need them How linked lists work Adding and removing from a linked list
Tags