0% found this document useful (0 votes)
88 views4 pages

Introductory Concepts Algorithm Constructs Arrays

The document discusses various data structures and algorithms including arrays, linked lists, trees, graphs, heaps, and sorting. It provides examples of how each data structure can be applied in real world contexts such as web browsers, memory management, social networks, and maps. The document also discusses algorithm concepts and constructs such as processes, threads, and dynamic memory allocation.

Uploaded by

Mukta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views4 pages

Introductory Concepts Algorithm Constructs Arrays

The document discusses various data structures and algorithms including arrays, linked lists, trees, graphs, heaps, and sorting. It provides examples of how each data structure can be applied in real world contexts such as web browsers, memory management, social networks, and maps. The document also discusses algorithm concepts and constructs such as processes, threads, and dynamic memory allocation.

Uploaded by

Mukta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Day 3:

Introductory Concepts

Algorithm Constructs

Arrays

Static Linking Code:

• During linking process linker embedds static code Lib file code into exe during exe or dll creation process

Dynamic Linking Code:

• Native Windows inbuilt programs are linked through Relocation Table in EXE which would be loaded at Runtime as
well as invoked.

Process: (Passive Kernel Object)

o Instance of Running Application


o Virtual Address Space
o Reserves future required resources for execution using Virtual Address Sapce with the help of Virtual
Memory Manager (VMM)

Thread: (Active Kernel Object)

o A Path of Exeuction
o Owns Stack

Every proces have Heap for Dyamic Allocation

Program under exeuction invoke malloc or new function uses Dynamic memory allocation

It is good practice to release unused data from heap by free or Delete

o Avoid No enough Heap Space problem by explicit Dynamic Memory Management


o Avoid Stack overflow errors by Debugging application and unncessary loops in programs

Other Kernel objects are: Inter process communction (IPC) objects such as Clipboard

Mutex, Semaphore, Critical section, events,etc.

Data Strucures are every where in Process, Threads, Stack, Heap, Kernel, even in Device drivers. More you go close to
hardware , you get less memory for execution with finite instruction Sets. So choose correct data structure and efficient
algorithms are important by developer. And good understanding of how code runs in enviornment.
Algorithm

An "algorithm" is a method for doing something, a well-defined set of instructions such as a computer could run. The name
comes from the Persian mathematician Mu?ammad ibn Musa al-Khwarizm, who wrote a book on numerical calculations.

Arrays :

• It is most used data structure.


• It is used in every possible situation where you need to gather similar objects at one place.
• Simple Example can be collection of all the book titles in a Library Management system

Structures :

They are Not Part of Data Structures by them self's

Rather, they are programming constructs through which you can build these Data structures.

Most Important Use of a Structure is Gathering of Data Bits which are Similar at one place in the memory

We treat them as one single entity.

Think of Library Management System all the Details Regarding

To a Book (Like Name, Author etc) can be placed at one place in memory using a structure

Linked Lists :

They Can Work in most of the places Arrays work. But Difference in usage depends upon two choices we make when we
design a system. Those choices are :

• Total Number of Elements in the Array Changes Frequently


• What Run Time Efficiency You need .

If Total Number of Elements in Array changes often the probably Linked list is better for that application as it is less costly
to add and remove nodes in a Linked List.
Good real examples to show the usage and importance of linkedlist:

• Consider the history section of web browsers, where it creates a linked list of web-pages visited, so that when
you check history (traversal of a list) or press back button, the previous node's data is fetched.
• One common sighted example is low level memory management (i.e. the heap as managed by malloc in C or new
in Java, etc) is often implemented as a linked list, with each node representing a used or available (free) block of
memory.
• These blocks may be of any size, change size (combine and split), be freed or assigned in any order, and reordered.
• A linked list means you can keep track of all of these "nodes" and manipulate them fairly easily. Also, Hashtables
that use chaining to resolve hash collisions typically have one linked list per bucket for the elements in that bucket.
• A simple real-life example is a Train, here each coach is connected to its previous and next coach (Except first and
last).
• In terms of programming consider coach body as node value and connectors as links to previous and next nodes.
• Our brain is also a good example of linked list. In the initial stages of learning something by heart, the natural
process is to link one item to next. It's a subconscious act. Also, when we forget something and try to remember,
than our brain follows association and tries to link one memory with another and so on and we finally recall the
lost memory.
• E.g. Consider the thinking process when you placed your bike key somewhere and couldn't remember.
• Another real life example could a be queue/line of persons standing for food in mess, insertion is done at one end
and deletion at other. And these operations happen frequent.
• Dynamic queues / stacks are efficiently implemented using linked lists.

Tree :

• Tree is hierarchical (or non-linear) data structure.


• A tree Can used always to produce a structure of hierarchic.
• Good Example is Any Mark up language uses Tree Structure called as DOM to Process.
• Most Important Link state Protocol Spanning Tree Protocol uses tree to represent network topology as a tree will
not have loops.
• One reason to use trees might be because you want to store information that naturally forms a hierarchy.
• For example, the file system on a computer: File system

Some use cases of tree Data Structure are:

• Have you ever used XML? XML parser uses tree data structure.
• Have you heard of decision tree-based learning? A machine learning algorithm.
• Do you know the domain name server (DNS)? It also uses a tree data structure.
• All software applications in the world somehow, they are using map/hashmap.
• Hashmap has its internal implementation is an AVL tree.
• You know database also uses tree data structure for indexing.
• Are you on any social networking website? You can imagine tree.
Graph :

A graph is a simple collection of nodes in a network.

Good example of graphs is a Map application which will give you shortest path from a point a to point b.

This application may be using nodes to represent different points in the map and applying algorithm to find shortest path.

You can use it to represent a network related routing for analyzing the dynamic connectivity of the path, or users of a social
media app etc.

Few important real life applications of Graph data structures are:

1.Facebook:

Each user is represented as a vertex and two people are friends when there is an edge between two vertices. Similarly,
friend suggestion also uses graph theory concept.

2.Google Maps:

Various locations are represented as vertices and the roads are represented as edges Graph theory is used to find shortest
path between two nodes.

3.Recommendations on e-commerce websites:

The “Recommendations for you” section on various e-commerce websites uses graph theory to recommend items of similar
type to user’s choice.

4.Graph theory is also used to study molecules in chemistry and physics.

Graph data structures is represented using vertices and edges.

By using traversal algorithms, we can find inding the shortest path between two vertices, and in Travelling Salesmen
Problem, to find connected components in a graph, analysis of networks, to compute maximum flow in a network

Heap :

a Heap can be used any where a priority queue will do the job.

For Example Huffman compression is a classic data compression algorithm that depends upon processing a set of items
with integer weights by combining the two smallest to produce a new one whose weight is the sum of its two constituents.

Implementing this operation is immediate, using a priority queue

Sorting :

It a kind of algorithm which will give some order to the set of elements.

sorting has many applications for example Scientific computing is often concerned with accuracy (how close are we to the
true answer?).

Accuracy is extremely important when we are performing millions of computations with estimated values such as the
floating-point representation of real numbers that we commonly use on computers. Some numerical algorithms use priority
queues and sorting to control accuracy in calculations.

You might also like