Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Data Structure Lab, SE Computer Engineering 2nd year
Description: 2nd year Data Structure Lab, SE Computer Engineering short notes made briefly focusing on the important points

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


Introduction | Data Structure Lab | SE Computer Engg | SPPU
Aledutron
The new series in which we will be discussing some questions from this cycle by fully pune
University
...
In this video
...
we would need a text editor to set up the things we would need in the next
video,
and then we can directly jump on to the questions
...
I am here at the
Linux mint home page so you can download the things and setup
...
The second thing is
the main home page for the sublime text software
...
If you
are getting some errors
...
what we can do is
...
So include iostream choosing namespace Http int main see out Hello
world then return 0
...
after selecting, you
can again use control B or tools and build so both would work fine so now why
to build and how this is all working so let 's just see the underlying process behind this thing
...
hexadecimal format
...
CPp file into an a dot out file
...
so what we are doing
...
So this all thing is
automatically done using this sublime text
...
This
works like this
...

So this is an package which you will be using for taking inputs directly in our sublime
...
If
you have not installed you will get an option to install the package control
So then you can click this and here you can put install so we have to install something so
package control install package
...
At last you will see new build system click on
that then clear all the constraints of this paste the thing which you have copied and
type the thing
...
We can again execute this thing while true and print zero so
we can execute this so here you can see this is going going on executing so to stop what
you can do is control plus break
...
we can use the shortcut
key to stop the execution so go to tools and click here cancel build so it will execute
...
Just used the basic setup and see how the things work so now We can directly
head on to the questions and discuss the questions
...

a video on that so that would be all for this introduction and setup video
...
a video of the question will be shown in the next video
...

write a Python program using functions to compute
...
number of students who play neither
cricket nor Minton and fourth number of students
...
in mathematics, it is called as intersection so basically
we have to find the intersection on these two sets so let 's see how we can do this
...
then we will go to next element and check whether it is
...

list called resultant, which will store the list of students who play both the things as we are
finding the intersection
...

So let 's just create an empty thing, then what we will do is
...
we can directly use the in operator or the membership operator to check
whether student is present in the second list or not
...

we have to remove 2, 3, 6 and 7 the intersection elements
...
we have to loop through each student in list L1 and then if student is not present,
then we will append this student to the main result thing
...
the question second list of student who either play 10 this 9
and 10 play badminton or cricket 145 but not both so these players not play both
the games so this
...
instead of copying the second
list, we are just create starting with an empty list
...
If that student is not present in L2, then we will append the
result
...
Let 's just execute yeah for a and we will set end equal to space
...

We are getting 2, 3, 6 7 B is 9, 10, one, four, five, nine and ten
...
we have to calculate same things or use the things which we have
calculated before so let 's just reduce the size and keep it so how would we do so either
what we can do is
...
The football
...


Cricket and fitball but not badminton, so what we can do is
...
So the players who play the football and then remove the
batman 10 players
...
Then we have to remove B
elements the elements from the set B
...
Now we are getting 8 and 12 same answer
...

Can now see the question is also printed automatically because we have used the docs
string so here is the question
...

You can modify this and play around with this and then the answer for this thing a b, c and d,
so let 's just put a new line here Now this looks fine
...
please email us at ireport
...


Question 2 | Group A | Data Structure Lab | SE Computer Engg | SPPU
Aledutron
We have to write a Python program to store marks scored in fundamental of data structure
by N students in the class write a function to compute the following first of all
average score of the class highest score
...
first of all
...
Instead of sum
...
We can directly use
the mark list
...
the average score of the class
...
What will happen If min underscore value is greater
than mark means what is happening We have set some minimum value
...

And we can use this simple single for loop so here just remove this command and put here
and then let 's just take this before this so if we keep this as it is what will happen
...
So they are called and used here, but they will not
find any reference
...
if mark is equal equal to none absent
student plus equals 1 means we are incrementing the value
...

Similarly absent student would be required to be declared before that so let 's just remove
this thing and declare here
...

we need a for loop again so for I
...

The question D they have set to display the marks with highest frequency
...
We first calculate the frequency, then for each key value in the frequency
...
For example,, 10 27 has a frequency 1 94 has 2, 20 has
4, 67, 1, 89, 1 and other all is one so like this, we can count the frequency
...
We can check if frequency of mark means we are accessing that element using
the key value
...
So like
this we will get highest frequency so let 's just print highest frequency
...

automatically
...

It considers this as a doc string so document string
...
We have n't added anything
...
display books in ascending order based on the cost of books
...
a function would take a name
and cost and depending on this
...
So this is same
as the list
...
so what we have
...
Our unique list would be
fine
...
if this book is in the unique list, we will not add
...
we have to inverse this thing so whenever
this thing returns true, the knot would inverse that value and it will create that false
...
So let 's just take some random numbers and this would be our books or the
cost of the books
...
We have to convert this element into this thing so what we can do
so Whenever I would have this list what I can do is
...
So here the minimum would
be one
...
instead of using this for
loop
...
will go one index ahead
...
3, then for 7, then for 1 and then for 4
...
the minimum value in this list is 1
...

Now is swap these two things
...
So swap we can directly
use the tuples unboxing to swap the things so what I can do is a of 0
...

Book list index out of range error error
...
index out of index error
...
index index index out out of number of elements
...

index out of the index error, So there ca n't be any index 7
...

we are looping on each of the elements of this list and going to each element
such as 2, 5, 3, 7, 1, and 4
...
directly checking with the mean value
so instead of checking with an index
...
Now we can see one two, three, four, five, seven,
...

We can say that list is sorted
...

Because after 7 there is no element present
...
We can index this and we can take the first element of this thing
...
So simply we have to add the
square bracket and one for each of the case
...
here we
basically check for the minimum element and put it at the first position
...
When we will discuss the main concept of sorting searching
...
To filter this according to some value I can directly
provide this value in this function and it should return me
...

Why because 300 400, 500 and this all elements so similarly
...

A class is used for creating a structure for the class book
...
to access the properties
...
This is a magic function given by the Python
...
It would take these two parameters name and cost and create an object
...
list so if I execute this here you can see main underscore underscore underscore
...
So here some address each
book has a unique address
...

instead of book list
...
return a list
...

So this is more readable as we are using object-oriented programming, but yeah so this
should work fine because we are printing the cost directly
...

This is the transaction lock for format D100 W200, so withdrawal is not allowed
...
Write a function for withdraw and deposit D means deposit while
W means withdraw
...
Then we have to take the input or else yeah, so
we will take input variable or what we can do is transaction lock So transaction lock equal to
input so we 'll directly take input from the console, and we will print a message
enter the transaction log transaction transaction log
...
What we can do is? We can store this entry in some
another variable, or we can put this into a list so let 's just create an entry list
...
on a new line
...

After the for loop completes we have to add the entry into entry list so entry list Eq not equal
to append so enter release dot dot dot append entry
...
We receive a comma
...
Let 's just give the 10 10 and again W10 so here now we can
see the same output which we have calculated using the for loop
...
After every comma we are going to get
a space
...
Add space as a deeliminator
...
that so as we can here see uh the list after splitting would have two elements
...
just
create a comment for now because we have n't created any deposit function
...

what we can do is if and only if the bank balance is greater than or equal to the amount then
we will reduce so bank underscore balance minus equals amount
...

the changes which we made here we changed the amount it was not reflecting in the original
bank balance so therefore it was having an issue so let 's just remove this
...

Question 8 | Group A | Data Structure Lab | SE Computer Engg | SPPU
Aledutron
A new question question number eight is to write a Python program that determines the
location of a saddle point of a matrix
...
I can store each smallest
value of row
...
there are n't any other saddle point
...
So let 's just take 4 and 9 so here the maximum was 3
...

Here maximum is 9 and in this row the minimum is 2
...
What will I do is calculate
the minimum value and insert it in that row minimum list
...
Should we check
for
column so what would have UH what would we have to do is basically
...
So now i will be the row count
...
So column underscore list equals empty list
...
of list
...
So I will create a column list where all the columns will be
stored
...
for i in let 's just implement a for loop and check
whether it is column common or not so for I in Roman list
...
for an m cross m matrix is said to have a saddle point
...

so first of
...
So we 'll print a message enter row
count and then he will enter that so column would also require the same so in input enter
column count
...
There means we are checking for columns
...
This would be all and we
will come with a new question in our next session
...

We will answer in the next session
...
This was the main program how to do this
...
So here we can give any elements
such as 1, 2, 3 4
...
This is one of the matrix and here
...
matrices can be of any
size
...
a single row can be stored as an
list so what we can do is
...
So in Python we
can call this as list in which this will be
...
would be 4 Comma 5
...
If I somehow
means if I somehow manages to traverse like this so first this element then this element
...
I can just go on adding this M1 plus m2s that index value
...

If you want to make this a bit UH useful and user friendly, then what we can do is
...
So let 's ask the row value so row equal to input
...

So input enter row value
...
If n is equal equal equal to 0
...
So here we don't know will m1 come or m2 come so what we can
do is
...
here we
should give
a colon and space so here what I will give is one, then two and three then again one two
three
...
I can look through each row at first just make it as
column in,
but how would I make so that I 's the question so let 's take the notation form so here I can
see we have to convert each row into column, but how we will do that so what is basically so
a simple thing
...
we will modify that so in transpose what we will do is
let's just

copy this thing only and we will modify it so yeah let me just paste this space transport copy
paste it here
...
multiplication in matrices is a bit complex
...
we have to consider the row of the first matrix and multiply it with the
column
...

Basically, how do we do this thing? So let 's just remove this at first and make some space
for some things and see
...
So here If I know these two are constant, so what I can do is
...

So let 's just say this is I and this is g
...
what I have to do is change this k depending on the number of uh columns so basically
Uh
...
for I in range
...
So first matrix we were using row, so we 'll use
the
row then for j it would be in column
...
I take the length so we would need the length
...
This is the row number so I can
directly take row so which are We can take the value so then what we can do is
...
I will take the answer matrix so first of all we
would need to also update that answer matrix
...
So why do we use plus equals Because first of all we store only this value 2 into 3 we
store into answer then what we do we plus
...
So like this we are doing
similarly, then four twos are eight eight eight plus this thing
...
It 's a
40 then again 4 into 3
...


Question 11 | Group B | Data Structure Lab | SE Computer Engg | SPPU
Aledutron
question number 11 states that we have to write a python program to store role numbers of a
student in an area who attended a training program random in random order
...
we would need a
student 's array in which we would store all the role numbers so let 's just create one i will
create
a student list and i will put the elements 10 40 45 45 67 89 34 56 78 73 90 1 and 37 so these
are the values i would take so as you can see these are in random order they are not sorted
so

basically we will see what is sorting
...
if index equal equal
equal to 1 means we can say student is not present
...
We require to check similarly, if we consider about
the maximum case what would be it, so it would be the first condition which we saw the
number does
N't exist
...
In this case do n't use the for
loop use
while loop so we will see this difference a bit later but for now just try to understand what this
internal search says so just remove the last element of the list and append some your key
...
If we are by using while loop we require condition that that condition
should be
...
both loops work same so here let 's just deeply analyze the how we how the for loop
works
...
at first,
I will be assigned to one so we will assign i equal to one
...

So again
...
Sorry
...

The question is regarding the mobile number and name, but first let's just implement the
simple binary search and then see how we can do this
...
Recursion is
basically function calling

itself so then what we will do is L plus h by 2
...
Using
the nonrecursive method, we can search for the answer to a given question
...
We must input some name and this
thing so let 's just give
simple names
...
it is depending on the names not by the phone numbers
...
we have to implement the binary search, so what will happen now
instead of getting a single value at a of mid, we will get two values
...
have to take some
random value and assign it for let 's just take minus one means we don't know the UH
mobile number because we have to
just said we have just asked to add that element sorry add that person
...


Question 14 | Group B | Data Structure Lab | SE Computer Engg | SPPU
Aledutron
The new question is to write a Python program to store first year percentage of students in
an area write a function for sorting this array of floating point numbers in ascending order
using first of all the
selection sort and then the bubble sort
...
find the minimum element and then we shift this to some
appropriate place and then say
that part of the list is sorted
...
For example, if we again try how we can do this so let 's take the same example and
try to think
...
So let 's just take some parameters
first of all the array or the list
...
N minus 1 Why we
consider that index as a
pointer and the left part of that pointer would be sorted, and right part will be unsorted array
...

The mean index for start would be i so for j in range so the range would start so let 's just
move on to this thing again
...

If pointer moves one point ahead, then we have to start from that index
...
the algorithm is called as an selection sort algorithm
...
we will first of all compare two
adjacent members whether they are in this correct order or not
...
For the increasing case
...
Then, what we can say this element is sorted similarly for the next iteration one
and three correct
position three and eight correct seven and eight wrong position
...
So here 10 was in
sorted position
...
If the first element is greater than the second element,
then we swap so we are basically swapping that but here when we are ranging from i to
length a so what will happen If we consider the length
...
It is kind of for this element 2, 4,
6 and 7 so currently,
the length is 7 and this for loop will go up to 6, but there is n't any 7th index why because list
start from zeroth element
...

So here first of all we are using a for loop of n minus 1 times
...


Question 25 | Group D | Data Structure Lab | SE Computer Engg | SPPU
Aledutron
A palindrome is a string of character that 's the same forward and backward
...
we have to write a C plus program with
functions to print original string followed by the reverse string using stack to check whether
given string is palindrom or not so basically here
...
a stack structure can be represented in a form of an array, so
let 's just consider
...
Sorry
...
So here as we can see as we go on inserting the elements and then pop out, so
basically insertion is called push
...
We can create a stack using a single pointer and
a stack so basically we can go on decrementing until the stack is empty
...
Let 's just keep top equal to minus one, so this would be
the correct index
...
if I want to push an element what I can do is, I can
increment this top pointer and add an element there
...

Let 's just head on to the text editor and let 's implement a basic stack' so I will create a class
stack which should basically have most of the things public
...
The topmost element
...
So kind of top will hold the index of the last position, so we
'll start from zero up to until where is the last element present in stack until the index top is
...
this scope array So here we have an array
...
So here size should be static because
we are using in the array declaration
...
still array
is not defined so in array iso for bits in class initialization of constant static member size okay
so maybe we have to provide unconstrained static so now this works fine
...
So now first of all
we would need to take a string from the user, so let 's just create a string variable user input
...
a and z are not considered y because we are
using greater than so F2 is greater than equal to because a and z will also be included
...
Why
...
We can
comment this display and after the we get original string
...
We can go on popping until the top is not equal to zero, so while
top s dot top is not equal to minus one so let 's just put an end line for better format
...
If a capital a capital is 65
and if we add 1 to it, it becomes 66 and the next character is B so kind of we are converting
it into the upper case so after so here
...
we can use a for loop
...
If both these strings are
same, then we 'll print it is true so first of all we would need a flag
...
question number 25 to find the reverse of a string
...
This stack inserted the element popped the
element from that and then printed it
...
Then we compared
each of the character and if both of the characters are same, then we can say it is a
palindrome
...


Question 26 | Group D | Data Structure Lab | SE Computer Engg | SPPU
Aledutron
In any programming language, mostly syntax error occurs due to unbalancing deeliminator,
such as brackets such as the brackets
...
an basic idea that I will get
the closing brackets and opening brackets and I have to do something so here
...
So if they have not set a stack, then how should we
think so basically we have to check for everything so we will put this we will store this
somewhere
...
this was the basic condition
...
Why may happen
So there was an opening, but we did n't found and closing so what may happen here This
stack would be increased
...

The pseudocode is the basic template hash include iostream using namespace everything
...


According to the side
...
In the last lecture, we created a stack and I have kept everything public
...
we
then print stack overflow and we return
...
Using this thing we
increase the top at that index we append the value Similarly in pop what do we do we check
whether this stack is empty
...
Some UH take the value last bracket
...
What we have to do is individually check whether it is closing parenthesis, closing
circular bracket or closing square bracket
...

We have to first of all check whether the stack is empty or not so we can do that
...
Basically false else else else what you
can say is return one and we can directly music yeah let it be for now it will be okay
...
So if
bracket is not empty after completion, Uh let 's just put not so after completion of the whole
string
...
In the stack means opening brackets are present but
closing is not present
...
Then at last what we can do is
...
at first, what happens is at first
...
would be empty why
because at starting of this thing, the brackets are empty,
...
If
bracket is empty and you have to check and is what we can do is when we have
...
empty or not so if it is a closing bracket,
...


Queue | Question 29 | Group E | Data Structure Lab | SE Computer Engg | SPPU
Aledutron
Qu
Title: Data Structure Lab, SE Computer Engineering 2nd year
Description: 2nd year Data Structure Lab, SE Computer Engineering short notes made briefly focusing on the important points