This tutorial provides a clear and practical roadmap for mastering hash table implementation while avoiding common coding pitfalls. It is an indispensable resource for students seeking to bridge the gap between theory and exam-ready code.
Deep Dive
Voraussetzung
- Keine Daten verfügbar.
Nächste Schritte
- Keine Daten verfügbar.
Deep Dive
9618 Oct Nov 2025 P41 | Yearly Past PaperHinzugefügt:
Okay, brother, we're going to start now.
Another paper will be released in October-November 2025.
9618 Paper Four Variant One and Quickly Let's attempt from. It's one of the most You can call it the easiest paper. it's not a Complicated paper. quick quickly We will see. You will show people, Will solve it. Let's get started. again I'm not gonna be doing it like in a Proper format of your paper Attempting format is that of Evidence is with the document. So I already did That in Yearly Sessions which I think may The 41st is from June 2025, so please check that out.
Who wants to see it. ok now let's move on to The Two Sessions Now OK Bismillah Rahman Rahim is speaking to you here.
Is it a stuck question? Basic Stuck It is a concept. solve quickly and let's try to understand how it Is supposed to be don. You people are saying Say Ah A Program Starts Integers in a Stack. The Stack Is Represented as a One D array of 30 elements with the identifier Stack. A brother has been created by the name of Stack.
The global pointer top of stack stores the Index of the last element inserted into The Stack. Top of Stack Is Initializing Negative one. So, it's not pointing Towards the next empty space. it is Pointing towards the last element. So Make sure that you guys are looking into Dec. Correct? Good. Now in Par Day you Asks people to write program code Declare stack, initialize each element in The array with the null value and declare and Initialize top of stack. Null value means You people initialized it with the nun of Have to do it. Ok? Right Program Go To Declare stack. initialize each element Array. Well, you have to initialize it also.
Ok? A Done. I think that's easy. and top of stack also needs to be initialized. No worries.
First things first, let's start with the Declaration First declare stuck colon array I'm Zero Colon How Many Elements Are There are 30 elements, so 29 of them.
Integer and after that Decla top of stock Well, some of the kids are in the comments.
Sir was asking why is it that you guys that you are declaring it a in part and Skipping all of the variables which are in the Further parts. A so there is just no Special format for that. It's just that We find things a little easier and proper There is a way to solve it in one way. of Course it's not in the marking scheme. But It's Just You Know Just to Be Say Just to Be You on a bit side. when you people If we talk about declaration then it should be declared properly.
Please declare it in the proper manner. As I am doing it in the comments. Correct? Ok.
Initialize all values quickly We do. Is it global? The Global Pointers? Ok. So, both of them are global.
So, let's make them global as well. Global Stuck this is this is useless as well. This which I do, it sucks too. But just It has to be done for the examiner. Top Off Stuck and let's initialize the values now.
Stuck is equals two.
Let's go with nun multiply by three Elements and then after that let's go with Top of stack initialized with negative one.
These were all the values that you people had Got it initialized. And this is your Part day. You are just supposed to copy this Code and paste it into the document. After that in part b the function that we have is Push. It takes an integer parameter if the Stack is full. The function returns false if The stack is not full. well then if the stack Full will be am the function is going to return Falls. If the Stag Is Not Full, the Parameter Whatever parameter is inside the push is inserted into the stack the point is updated And the function returns to. again you are not Suppose to memorize the code. It's just you If you understand the basic concept then do it accordingly.
You can write code from it. So, let's just Get down with this as well. Easy Codes Dev Push. Let's go with date to push.
And then we will have to take the stock global.
We have to go global to the top of the stack and when both these things We will take it, now we have to create basic conditions. Now Look, while creating the condition, it's okay you are Just Supposed to Pause and Think Always Last Element Consider the last element always Because I want to see that the stack is full.
So I have to look at the last element. Index The position will be 28. I will check on the 28th.
Is 28 greater than 29 now? Not there. So Currently there are 28 available from Lets. Top of The stack is pointing to 28. I'm 29 now I need to store something. So as soon as on 28 I will say it's top up stack greater Than equal to 29? No it's not that means I Have space. That means what? Now you will go Get your top-up stack plus one at Rs. 29 You will store it. So as soon as there is a store on 29 Your top-up stack will be at 29.
Will go. That means as soon as the top of stuck 29 will be equal to or greater than that then that Means your stack is folded. So that's it.
The condition was created in the mind automatically. If Top Up Stack Is Greater Equal to 29 in That Scenario What You Guys Just Suppose to Do You guys just suppose to return false. donation After that if top stuck train equal to 49 If not, then it is a very simple game, top of stack equals top stack plus one Get an increment. Empty Spot Empty Go to the spot. Look into my mind Complete imagination is going on. So pick him up now that we have brought one up. bring up After that we will go to the stack. wherever The top of the stack will be pointing there Will go. Go there and push your dater The value will be stored. and then After doing what you guys are supposed to Returns true. That's it. There was so much work that That you had to do in the code with the push. Let's Move on to Part C. The Function Pop Returns the next integer in the stack and Updates the pointer as appropriate if there is one There is no date in the stack. that function Returns a negative 99. So basic pop's You guys have to write the code. There again the Same scenario. You people have to value and after lifting the value what you guys Are supposed to do. If there is nothing Inside your stock that means you now If you want to give negative 99, when will it be when the top Off stuck will be equal to negative one.
It is such a simple game. The Global Stuck Global Top of Stuck If Top of Stuck Is equals to negative one in that scenario.
I am suppose to say ah returns negative 99 999 And if the top stack is not equal to negative one Then I have a method called data return Let's create a variable in which we We will go to our stock wherever our top is.
Off stack will be pointing. from there will pick up the value and after picking up the value -1 on top of stack will do. Direct Don't return it. please make sure Because returning the next lines runs It doesn't happen. So first you put all your pointers Adjust it and then return it. End After doing that pop, after doing the main The program generates 40 random integers.
Between zero and 1000 inclusive. So whenever If you want to create random numbers then Then we need a library.
Which we call import random names From. Correct? That's the Library That We Are Going to use an attempt to insert each one into the stack using the appropriate function If the return value of the function call Indicates the stack is full. As soon as the stack is full, no more integers are generated.
Well, let's try to find 40 random Do integers. But as soon as the stack is full Once this is done, we have to stop our loop.
It is not necessary that 40 out of 40 be generated.
So it's just that as soon as we have stock It will be full, it will be the same thing in a way.
Bhai, the stack is full, that means there is no more space.
If it is not there in the stack then of course give it just No need right so there are 40 random integers so If the stack gets full at 30 then after 30 the Loop should stop right so just according to that We have to create a simple condition. So that's it Basic sa hum logo ko I think 40 times The loop is to be run for and after that whatever By entering rand from zero to 1000 in it Which is to generate random integers. End If I have a false value from pushing comes in that scenario I am just suppose To break my loop. Simple. You can use the flag loop You can do it too. But now because we have Validated from a lot of marking Schemes That You Guys Can Use The Word The The statement break which is Python's own The statement is called break. So Use the marking scheme It has started. So we can use that. Correct Is? So no worries on that. So the first thing What will we have to do? for X in Range It Makes Things Way Easier. for x In range 40 And let's just go with rand numbers Is Equ to Rand Random Library Name dot rand int In this you specify the initial values both R and inclusive. Correct? then returns random Integer in range a b including both and Points. That means what? that they both are Inclusive. Meaning both are included. So From this we have random numbers one by one It will start generating. Let's just Go with let's call it push black so we Will get the verification done. So now push in I do it. Whatever random number is generated He must be there, I will keep pushing him. And now I will create condition that if my push flag value of Falls may occur. In that scenario what I am Suppose to say I am suppose to print the value That my stuck is full.
What did you want to write brother? Let me see Stuck Pull.
OK, Stuck is Full with in Small And I'm supposed to break it, meaning I should Stop.
Ok? So break basically stops the for loop.
If the for loop has run 30 times. alldo this is something which is not there in the other Languages. You have other languages This option is not available, but in Python you Do have the option to break the for loop. Yours He will stop according to the conditions. Correct Is? Let's go sir. Now let's move on to Part E.
In Part E, he is telling you that is the procedure FindValues. Let's just take this down.
That's our main program.
This is where we start coding.
Are. Which is find values. Pops Each Integer from the stack. what do you want to do Are? You people have to make a procedure which that you guys one by one ah pops each Integer from the stack until the stack is Amputee. As soon as the stick becomes empty that This means we have to stop our loop. as soon as Ah Like let's get stuck empty. Meaning As soon as we get the value negative 999999 Will go. That means your stack is empty. End then it will find and output the largest Number That Was in the Stack. Ah In An Appropriate message. The output also has to be done Inside. Then find and output the The smallest number that was in the stack is n Appropriate message. Ok?
That's doable. Not a Complicated Find Values Okay one by one we have to get it popped. Good Watch whenever you come across pop or When it comes to largest or smallest We always need reference values.
Reference value is always the first value In your array or stack. Whenever you have such When Values Arrive, Make Sure to Use Them First Value as your reference value. then from him Then we will compare and find the smallest one.
and shortest key which ah smallest and Figure out the values of the highest ego.
Will get out. Correct? So let's just get Started. The First Thing Is, of Course I Need A let's just call it return value. thats The value which is being popped. And We Can Call it popped value. That's a Good Name as well. Popped value is equals to pop.
We called our pop. From him we had a Got the thing popped. I'm basically making a Reference Value Right Now. Then now I Highest value has to be created and let's just Call it largest.
Largest is equals to pop value.
I'm doing the initialization right now.
In a proper way. And smallest is equal Popped value as well. so these initials There will be initialization. Even in the largest I put that in. Same in the smallest Put it in. So this is basic basic Initialization. Now I will tell you my conditions I will start. Well now I think We will create the condition flag by looping through.
I said flag equiv Falls. Because I need to stop my loop.
Is. When to stop? When I have negative 99 Come. I said flag equals two fouls.
While flag is equal to equal to false.
In that series What Am I Supposed to Do? I I'm supposed to start comparing first.
If Popped Value If Popped Value is greater than highest is greater than largest Is Greater Than Largest If Popped Value is greater than largest Then largest is equal to popped value okay and I'm not supposed to use it myself This is because we have to first select the largest one.
I have to see it, then I have to see the smallest one also.
So if you put else if, just I saw the largest one, then your small one.
It is not being considered at all. So that's a Wrong approach. Then I have an if condition Will have to make it. Another if the popped value is Greater than smallest.
In that scenario I am supposed to say Smallest is equals to pop value. And As the loop continues We As the loop continues I also have to stop my flag. OK for That's what I'm gonna be doing is popped Get it popped inside the value. again right?
Get it popped again. and get it popped here What you should do after is here on condition Make. Hopefully it works. I am not sure Two if popped value is equal to equals to a Negative 999 right? If popped value Equals to negative 999 perfect. in that Sario I just suppose to make my flag Ojoit. My flag will be true. So that Means my loop should stop. And if my popped If the value is not 999 then check it again.
Will do. Yes, the code looks perfect.
Me so. Correct? So that's how your It will go perfectly and go up again.
Will see. will see the popped value. largest Will see the value. He figures out your things.
Will get out. So I Think That's the Perfect Code. Correct? We will verify it again. No Vaz. Ah extend the main program to call FindValues. Now you have found your Calling the values. Ok? Let's do That's as well.
Well, there was another thing with it. A You R Supposed to find an output. The output also So it has to be done. When you set your flag true are you in that scenario i should output a well. So let's output print the largest Largest number.
is comma largest print The Smallest Number Is comma smallest okay i think we're good to Go now let me just fix the Largest I don't like it I don't like it that way okay the largest number is The largest the smallest number is smallest Just I think as soon as the flag is true We printed it and then we up The flag will fall and it will end That's It We're Done With The Loop So Hopefully This Works Right Hopefully Hopefully Let's Just Run the Code Let's See How It Goes The largest number is 999, the smallest is 999.
number is ne 999. so there is there is a The mistake that we did. So let's try to Figure that out. what mistake did we make So this is our negative 999 end.
The smallest number is 999, it is coming out wrong.
Is. Right? And that's giving us output.
Your stack is full. Let's do one more thing.
how about we a Print the values of stack as well. Me I need to verify that my stack is even created.
Or not. Right? So for that what do we do Needed?
A Akka second is there any other parts which i Have you skipped? We created this random number Where did you do it? Oh my bad. Here it is.
That's the mistake. So we found values.
Called upstairs. that could be the Mistake. We should call this one down.
The reason is that something will come in the stack first.
That's why I think we can do something. So Listen to the code now. There was no logical Mistake. The largest number is 992.
The smallest number is 992. So, that's wrong.
Answer for sure. So, we have entered a condition incorrectly.
I have made it. Look at my actions.
Mashallah. So, if popped value is greater than largest, if popped value is less Than smallest. In that scenario, suppose to From. So, let's run the code again. Hopefully this It is perfect. So, 992 is the largest number, And the smallest number is eight. Correct? So Learn to validate your answers, find Learn from mistakes. That's a good thing. thats A good example which is in front of you right now It has happened. So let's go, that's a good thing. Correct? So We make our own small mistakes. would have happened Are. It's a very normal mistake. So you Are you just suppose to figure it out and then That's it. So, look at the second thing, I How did you figure this out? was above My stuck fall was showing up later. that Meaning, I must have made some mistake.
This was the right answer. fixed bugs? So That's it. Alhamdulillah everything is Perfectly fine. So Perfect We Are Done With Question number one. Let's move on to Question number two now. Okay that's it. These Question one is done, question number two now.
Ok. What does question number two say?
From you guys? Let's read this now. A Program stores data about a train and train stations using objects Oriented programming. The Class Train The Class Train stores the data about the Trains containing train IDs inside trains There is a number. The train will have its own ID number.
It will have a route. Stores The Route Number The Train is travelling. Stores the route number.
Good route number. It's Not a Name It's a number. after you guys inside it What is? then given the constructor Is. It initializes train ID number and Route to the parameter values. So the thing it what is doing is taking the train ID number is a parameter in route and it is Initializing it with the attributes.
Ok? perfect. Gate Train ID Number Return The Train ID Number. GetTrue returns the Route number. The train is travelling. Ok? I Think Part A Should Be Quite Easy Because It is very basic. Let's do it quickly.
Last train in which what you are suppose to Do is basic declaration of your Attributes.
Train ID number my bed Throw Odi Nobo call in string good train id number which is that's the string we have okay end Then the root itself is integer, so let's do that as well Private Route All Integer And after that is what you are supposed to do Is constructor in underscore underscore Self train id p comma Roots Root P cell dot underscore underscore Train ID Number is equal to train id e cell dot underscore underscore root p = root p and after that we are done with This is all the work done till here and what else what else what else We are done with party ai right perfect i Moving on to Think That's It OK Part 2 Now they want the Gators, so the Gators too Let's make it that easy as well get trained ID number It is necessary to pass the self because that Represents the object itself. Then Let's return it. My Bad Self dot underscore underscore entry ID number It is necessary to pass the def gate root cell in this Too. Now I am supposed to return sale under underscore Hey, where did Root P come from? that's a Mistake my bad. Let me fix the name.
Ok. Ok. Ok. perfect. So, cell dot under There is root. It's not Route B. Ok? perfect.
So, we are done with this as well. Two Gate Raises The right program had to be made. ok, bye the Why is he giving three marks for this?
So, it should be two marks, right? one of its There must be a mark, a mark of it Needed Let me just quickly verify with the Marking Scheme. Where did his marks come from?
Are you with us? If it's winter, right?
What are the marks for? Three. Final Open a second scheme.
One Get Method header and end with no parameters Returning Correct Attributes Second Correct gate method good you correct Returning attributes in headers You are making the right one, not the first one, what a waste There is a marking scheme, it has one mark There is a mark and both of them have a mark Well, it was perfect, let's move on to Part B Now the Program Is Tested With Four Trains. You have four trains available.
That you people have to make it. Right Program The program to declare an instance Of train for each of the four trains. And you What is the plan? Four objects have to be created.
Instance means object. Ok?
This word. Let Me Just Highlight This Word You guys. This word is object. Right Program code to declare an instance of Train for each. Is a straight line drawn?
Brother? With the mouse. Mashallah Allah subak. Ok Let's move on, where is our train? What What is his name? Train ID number right. Ok, Let's just make this now.
We make ours here, let's just call It First String Train to which we have to give train ID number Is. That's the string value right. So 12 adb Then the route is the 134 Perfect Second Train = train 33 ART ART Right Comma Train Then the Third Train Equipped to train 9fk 9fk And then the three values Forth Fourth Train get on the train including 21 VCs Put 24 in it. ok this is your part B also Done. After That Next Point Part C Key We are walking towards it. which is The Class Station stores the data about the Stations. Well, I think so now There is the concept of containment. It's done easy.
The question of containment is related to children. Say are the class station stores the data About the Stations in which we have stations ID is there. There are numbered platforms. Store Di Number of platforms at the station. So when If you want to understand the question, always Use examples. like here The platform numbers are written on it. that Means store the number of platforms at the station. means let's say let's say that's the Keywords. Let's from Let's to Five The platforms are there. Ok? are saying Trance which is your zero call in means 10 Trains may occur. Starts the Train Current at the station platform. an array is off train means a containment There will be trains inside the concept station.
Ok? In which we have 10 of 10 trains Elements are given. Stores The Trends Current at the station platforms. Now!
Which are the facilities currently available on station platforms?
Are? Then number trains. Stores The Number Number of trains currently at the station Platform. How many trains are there right now?
Are they available on your platform? from lats There are five platforms. Correct? So on that There are four trains, three trains, or two If there is a train then it matters.
What is the constructor doing? It Initializes the station ID and number platforms to the parameter values. So These are the two things that you need to know about the parameter value.
Have to take it from. It initializes trance to an Empty array. This is to create an empty array.
Of. Self-dot undersides made from traces will equals to empty empty Brackets. Numbers tend to zero. Easy. Now You have to make gate trains. So trends a String Containing Data from the Train currently at the station platform at train Takes a train parameter and stores it if There is a platform available if any If there is a platform, he will stop the train on it.
Each platform can only have One Train Moves Towards Perfect Part I While each platform can have only one The train is trying to say, we understand this.
If there are five platforms, then on five There can be only five trains, not this that double parking is not working ok ok OK OK UNDERSTANDABLE OK LET'S JUST MOVE on and what's the name of this station right now We make the station our own.
The whole class. That's right sir. The First Thing Is Depth station.
No Need for the Brackets Because It's O Mashallah not depth station brother class station.
Ok. We need four attributes.
Private Number platforms Trend Array off off off off train Okay, private trace call in array 0 Call no off train Number Transcribe Call In Four attributes made all four perfect Now let's make the constructor now What do you say brother? Station ID has to be taken.
Let's Just Call It S ID P and Number platforms Number Number Platform P After that they wanted me to assign it to age A. Parameter value. So Self Dot Station Store two SI DPs inside the ID Meaning that's going to be the string value Right OK Perfect Cell Dot Underscore underscore number platforms number Number platform p ok that's done Then create the array from train brackets Then initializing the number array to zero Is.
Number trance is initialized to zero. These Your constructor is ready. now the The next thing is get trance. Part Two Key Let's go to the side. Okay, what about part two?
Is? It's an ad train, brother. Ok? So first at You will have to make a train. Saying The Method Ad Train takes a train parameter.
Ok? The Method Compare attribute Numbered trains and numbered platforms To Identify If There Is a Platform Available. A Platform Currently With No Train.
Correct? You need to first check that your Is there space nearby or not?
The Method That Trends Fall If There Are None Platforms available. How will we know?
You can find out by looking at the number platforms Will go. Easy. So if the number train is less than Equal is less than number platforms isn't it if there are five platforms from let's And I have two trains so 2 is less then 5 okay so that means the number of we have There are fewer trains and platforms.
If there are more, I think that should be the Condition. Correct? If our number trains Are those numbers equal to the number of platforms or become more than that in that scenario I I am supposed to trend falls. Ok? Ez If there is a platform available stores The train parameter in the array trance means It has to be appended. Updates The AppropriateAttributes Return True in The method returns false if there are no Platform Available Easy Understand Meaning If we think a little, it can be done.
We have to make an ad train.
In this he will take train as an object Let's call it a new train.
Then what are you saying? Ok. the first thing is I need to check if I have space.
Or not. I just I can just say if Where can I find out the number of trains? If self dot underscore underscore number Trance is greater than equal to Self dot underscore number platforms.
Why am I doing this? That's the question.
The Reason I'm Doing This Is Because He had said it in the question here.
The platform can only have one train. Right?
So if we have five platforms, So there can be five trains, more than five It cannot happen. So if my number of There have been five or more trances It has happened, then that is not possible. Right?
So you're just supposed to return Falls. And if there is space, then what to do?
Have you said it? Store your train. Where Will you pay the store? Go to your store do. So let's do that. Cell Daughter Tr Pay Go dot append.
And after appending the dot, the new train Put what you have taken out in it. Then Increase your appropriate attributes Have to do it too.
Ok? cell dot underscore underscore number Trance plus one so that we can find out That brother, a train has arrived. and then you are Suppose to return true.
fixed bugs? perfect. Ok? after that Let's move on to part three. The Getter who is You are getting your gate train built.
In the name of which you will get information Have to print it. What is? Let's read a little Let's make a little bit of this first. Ok? Say The Method Get Trance Returns The string there are no traces if there are no Trains at the station platform. ah how Will I find out? if self dot underscore Underscore Number of Trens is Equals to Zero. then you just suppose to say that there are No trance. Else If If There Are Trains According to that, you will get some different things.
I have to write it. What are those? Just look carefully.
I am asking you that is who you guys are Supposed to right the train at station Station ID R This one line. Then on the second line you The output is what is going to be Train ID Number On Route Number Route Well, repeat it as many times as there are trains.
To output. OK OK OK so a for loop According to the length of the train, it is okay to Whatever your length is, it is length, yes length You can also do it and as many trains as there are Dafa can also run a for loop like That's both the options are available right yes Meaning to length of cell dot underscore trance do that's basically number of trains which cell dot underscore underscore number trance Are that the counting of number of trains Right, we can use that too.
People, okay, what else?
So according to the number of trains there will be Bring your train ID number and Bring your route number because we do Have Gates for That Gate Train ID Number Get route easy ok got it so let's just do This line first serves the station one are the tr string there are no tr Okay, one more thing.
that is Hum that's a tricky point.
Here if we have different lines If you had to print it on paper, that's quite easy.
But because it represents a particular value Want to make a return. Right? De R Saying the get rain returns the string. So If this is being returned, that means I should We are interesting. So this gives you a single You will have to create a string so you can return it.
As a whole value. then if single string then this new line new line I am going to pay. We are here for what we can Do Is We can make this line and then add a new one line character over here And then concatenate this line with this. So The new line character that comes automatically is Going to make this on a new line then I Can add a New Line character over here this is going to take it on a new line okay Got it perfect easy done so the thing is We can add a new line character that something what we can do to make this is a single string value so it can be Return can be return as a whole string right so I think that's the scenario let's Just Do It Now Okay, we're interesting, interesting questions.
Interesting question, first thing's first.
Let's just start right then we'll see Let's figure out if cell dot unders Underscore number train is equal to equal Zero and then in that scenario I'm just Suppose there are no traces to return Hum That's It Perfect And if there is a train then you will get the first line.
Have to make it. Firstly Let's just call it no, I'm gonna call it It's what let's just call it, STR means.
Temporary String Let's Just Call That Okay in this what I'm gonna be doing first line which is The This should only be once right, so this for loop at station Then the station ID should appear here. End Station ID is Kind of like we would add space here Are. Let's get the station ID. Cell Dot underscore underscore station ID We What comes after the plus station ID? R And then colon. Right? There should be space. R And then a colon is it together anything yes Together and Then After That I Am Supposed To Add a New Line character This is how you Suppose to add a newline character newline Our character is something like this Okay, that's done, one line is ready.
Yours Let's Just Do It This Way Perfect the First line is done now i need a for loop for x End Range Here the number range is put so instead of Doing Lengths Is Going to Give Me the Same output self dot underscore underscore number trains in that sir I am just supposed to go to every single train and then to will go to As an Array one by one and from there Okay got it got it got it got it got It's perfect what I'm gonna be doing M Gana Making Temporary Train Variable I'll go inside this cell dot underscore I'll go to the underscore train one and one by one I will do this and take up the entire train.
Correct? Because it has full train are present. Right? Objects of Tress is present. After That What Do I Know? I Need the ID number. So, I'm gonna be doing ID number. Right? Do I need the ID number?
Yes, I don't need the ID number. Then I I will go on the temporary train. My bad.
Dot Gate. What Was the Name?
Gate Train ID Number. Let's Just Copy Dec.
Paste This Here. Gate Train ID Number.
Ok? And then the next thing that I need Is a root.
Root is equal to well root is one is an integer value. So for integers, Need to make this as string. So temporary We will use the train only. Dot Gate.
What's the get for the root? Gate Route Is.
It is not detected automatically. you are Suppose to do it by yourself. Do Not Forget To make brackets.
Ok? to tem train dot get train id Number route arrived. Now what I am suppose to Do? I am supposed to make the line now.
Right? Now I have to keep adding.
And keep adding new line characters.
Ok? Got it. perfect. So each line Will have to make it. Let me just give it a little Let me do that for you.
Let me just know you make it smaller for You guys, please do a little so that you can see something brother.
Okay that's perfect I think. ok so we What did people do? I took the ID number.
Made a temporary train. After that I am Supposed to make the line now. So temporary Store it inside the string.
The old value of a temporary string Concatenated with a new line that we are Going to form. So let's just make a new one Line first.
That's Going to Be Helpful New Line.
New Line to make The First Thing That All you need is the ID number. So ID number concatenated with ID number concatenated with On route number On route number Right space dalo On Route Number There is a space next to the on-route number. OK Space Put it. Now I can enter the route.
Put the root. With that I got New Line You have to enter the character. New Line character is Always backslash. Make sure this is me new Made a line. What should I do now?
Have to go to the temporary string. inside him Need to store temporary string Old Values Can Coexist With the New Line. What happened brother? He became a genius.
Hopefully these words I am not pure Sure. But of course you will know only after running it.
Will work. So I think that's it. and then After that you will exit your for loop.
And in This You Should Return Your temporary string value is correct.
Gaya bro Sam that's it right that's it ok done done done done done It's done now he's saying the program is Tested with two stations now we have stations Also have to be made. The first one is we have STH Station ID number of platforms is two In this again NPH that is one that pay number of Platforms are one saying right Program code to amend the main program To declare the instance objects are of stations what is this as one station S TH bol dete hain is equ station Station inside which what do we have to offer?
First Station ID Station ID has to be given in string format.
Right? So that's going to be sta comma Number of platforms that are integer values and then station You can name it anything. NTA Equ Two Make a station.
In Just we have ID NTA One platform is there. And then after that Part Two Attempt to Stop at the Following Stations in the Order Given we we Train One to ADV will depart from Station STH ok and Train 33 will go to ART station STA.
The train will depart from NF KF station STH.
Train 21 will depart at VBC station NTA.
Write program code to amend the main Program to add each train to the given Station using add train. We add trains to our do. We can add it easily. Ad train Returns any value inside, that is true End returns false. perfect.
The output is to station is full. If our Pass false value will come, that means your The station is full. You can't add. So you The station people have to output it. That's it.
Output the trains at each station using gate Trance. Then what do you have to do in this?
Output the trance. Also output to trains Have to do it. At each station using gate trains.
Then you'll call Gate Trancess so you can You can print their values. It is easy Went. Got it. perfect. Let's just run now.
We are interesting.
What is the plan? Add each trinity to the given station. Ok. Let us start first People from adding. Right? So let's just call It Let's flag this as a return ad.
When I train add a flag I will need it. Add train in which first I want to add A South Station Wala.
station sta dot ad train in which we Will add train. Which train is it? First 12 ADV Wali. Which one is this 12 ADV one?
Was it a train, brother? It was the first train. so that's What I'm gonna be doing.
If Add Flag Is Equal to Equal to Falls In that scenario I am supposed to print Station Is.
Ok? That's something what I suppose to do.
Let's make this copy because now we need to copy it.
Has to do with multiple trains. ok now 33 ART in STA What was the 33 ART?
It was the second train. So let's just make this Second train.
According to that our flags will work.
And 9FKF 9FKF it's the third train. So now We will add the third train here.
Third Train Then the fourth train will go on 21 VC The one that was there was the fourth train that would go to NTH.
Station NTH Pe To Fourth Train should go to We will have to change this station also.
NTH Accordingly all our code will work Perfect Now What Do I Need I Need To If you want to call the gate gate then turn off the train.
Course that should be in print statement Because it's returning a string value So put this in the print statement Will have to. station STA dot Get tense I'm not sure what's going on To be there errors will come but they will be sorted I have to do it, Inshallah.
station Nth dot get trains let's see if the code Works.
Bismillah Rahman Rahim there could be errors In the station is full ok starting he Bola station is full the tr at station s t HR 12 ADV 33 AR T Good Only Only two trains can come, right? Perfect.
So he did not code the F of NF EG ho Went Then the Trent MTHR 21 BC on route 24 Perfect friend, the code is working Is. Everything is perfect.
Okay, perfect. That's it. We are done with this Code as well. We are done with questions Number two completely. It is completely complete.
Have to take a screenshot of this. You have evidence to be put on the document. We are done with Dec. Okay, perfect. Hey brother, I know Go now. Ok. Now let's start with Question number three. Now. Question Number Three.
Ok. What does question number three say?
From you? If we look at question number three So question three asks us OK OK OK OK OK a program Stores records in the two-dimensional array hash Each record is stared by the name of the table at a specific index of the array that is Calculated using the hashing algorithm With the records' feed. However, whenever the hash Some questions come in the exam, right?
I want you guys to get confused brother sir He had said that brother #sh The codes are not even in the syllabus.
and it's now being removed so yes such Hey, it's just a very basic concept of Arrays which is coming in your syllabus.
That's not the actual hash table that came before The things that were there in the old syllabus were ours Near. It's Just a Very Basic Files Ka It is a question of question and record. It's Not something which is related to hash. Ok?
Ok. Let's read things further.
A program stores in the 2D array hash Even. Each record is set at a specific Index of the array that is calculated Using a hashing algorithm.
Good sir. Each record is stark at a Specific index of the array that is Calculated using the hashing algorithm With the Field of Records. The array has 100 / 10 elements. Ok? So 1000 elements.
The Hashing Algorithm Use the key to generate an index between Zero and 99 If the key fields are generated, if the two key fields are generated The Same Index. If the same index is obtained, There is a collision. Any Records That Have a Collisions are stared in the next space in the Same index. Okay, that's right. Meaning beans will move to index position three and then Zero then one then two. oh ho ho ho ok ok OK Understand For example, in this table two record keys Generate the same hash value of one. Four Record keys generate the same hash value of Three. So 30 31 32 33 333 so these four The records are yours. Ok? The Program Uses object-oriented programming Class Records A Stores data about the records Key Integer Data String Constructor Banana is to initialize key and date to its Parameter Value Meaning Basic Record Data Type banani hai easy let's just get done with it The Things Which We Are Easily Able to Solve So don't be worried about this, brother.
I am not able to complete the question as much as you can.
You do what you are doing, it means you gain marks.
So record your class.
In this we have to keep public data types.
Are. Public attributes have to be kept.
Public of colon integer Public Data Colon String And After That What Do I Need?
These self should Need data We have to assign this to self dot okay Whatever public attributes there are If the underscore does not appear, the underscore For Records You Are Not Supposed to Use underscore underscore so in this one We assigned the value You have assigned the value Dalta P.
Ok? So You're Done With the Record Date Typed point. Good sir. Next Thing What are you saying to people? In this our The key passed is integer. The string is Which is your data? It's perfect. Ok? Now saying initialize inside part B Hash table initializes each element in the array to an empty and Tap.
To An Null To an empty and null record OK Empty and tap to create the record. Right Program Code to declare the global two-dimensional array hash Table and the Procedure Initializer Initialize hash table. Well, you first Write program code in which you can create global You will create a 2D array. Then after that you Procedure has to be made. So the first thing that What you should do is make the array first and global.
Making means outside the procedure easy. Ok Let's just declare that Hash Table colon array first you declare row 0 Column 99 Now do the column comma, so how many columns were there?
Column 9, 10 columns were of record that you Just made it Its name is Record Okay Perfect Ok. We're the next thing you should make.
A hash table. Oh my bad.
Create an empty array of the hash table.
Okay, your work is done. After that you What is the plan? Initialize Initialize Hash Have to make a table. initialize Inish Hash tables are fine What do we have to do inside it?
Empty Records has to be made right then What do I need to do to create empty records?
I will have to do whatever I have, one by one.
I have a hash table and I have an empty array.
I will take Global. Well, I should have taken Global as well.
So let me declare this a little bit global as well.
I will have to do it here, friend, let's just do it.
that That's right, okay, first take global because It's Outside the Procedure Global Hash and After That's What Do I Need Is For 's Loop For x & Range We For x in range For x and range How many times do I have to run for x in range You have to run it 100 times, that's 100 times a day.
We what needs to be done Do you declare the global to i hash Procedure initializes hash initializes each Element. Okay, going over each element one by one.
An empty record has to be created. Correct? So What I Can Do Is For X in range 100 well let's just do it This way. For Row in Range 100 for column in range 10. Ok? With this we can analyze each element individually.
Will be able to go. And we have to go there and find an empty Creating and storing records Is. Ok? So always you should adhere You should always append.
We already have the concept of replace in this.
No. So this is not the right approach. So What I need is what I need to upend.
We We we we That's a wrong approach. in this way because we have to off course If there was a replace concept then this was Possible. So I think what we should do is we Should make a complete row first. and then that We will append the row 100 times.
That's a genius idea.
Right? Mimimimi might. So let's Make a complete row. cry whatever happens that's it Let's just make that first. Row Equals Two What are empty two-dimensional arrays?
It's it's just multiple one d arrays. Right?
So first I have to make the roe. Row Empty We make roses and then we use those roses Will append it. Oh ho ho ho it's done easily.
For Ro for Rose in Range Let's Just Call It for x for x in range because how many Do you want to run the case? I have 10 elements in one Inside the Row. Correct? Inside this we What to do? Our I have to go to the row array. append to Is. What to append? 10 Times Us Will have to append. Inside this your Records have to be written so records have to be made In which make us an empty record or Make a tap. So let's just go with the negative One and empty quotation marks. Ok? So That will make us cry. cry one by one It will go completely in which we have 10 Records will be inside entire elements.
Now what I'm gonna be doing? I'm Gonna B. Taking this row and then adding it to the hash table I will append it inside the array containing 100 times. That's the idea.
I don't know what I am doing. Well Lets Do it.
Now I need to pick up this row and append it 100 times.
inside the hash table. Hash Table Dot Append Cry. OK that works right.
What will happen with this? A full roast will be made. one by one By doing this your entire daily will be added.
So a 2D array will be created. It's done easy. I think It's done easy. Let's just verify this. I I'm not sure. Let's just verify this. We Initialize hash table.
print#sh Array of tables. Print the array and see There are a few.
How does it look to us? Main Objects Main Objects Types Shown Are. OK I think everything is fine. It Looking good. It looks good. So this is your one array is being created in which we have a The record arrived. The second record arrived.
The third record arrived. perfect. I think That's good. That's good enough. Hopefully.
Ok? So that's perfect. We made every day and we stored those rows inside the hash table Appended it. So we are done with this.
perfect. Ok. Now let's move on to Function#sh. It takes an integer key field as a parameter. Takes an integer field.
As a parameter. Then calculates the Hash value. Then your flower will be prepared accordingly.
He has given that mud 100 and then you Just suppose to do that easy. that's easy as well.
You guys made an ad in the name of hash.
which takes your key value as a parameter and then this key Mode means the sign of percentage from 100 And returns it. I think that's it Nothing complicated right. Ok? I think perfect. Now let's talk about inserting data.
Yes brother. what is insert doing inside data Is? tex an object of type record is a parameter. It calculates the hash value for the parameter using the appropriate Function. It stores the parameters in the Correct position in the hash table. If there is cogen then we will get its separate index I have to go to the position. go to the store there Have to do it. Ok? I Think What We Can Do Is Once your hash value is generated, I should go and verify his daily routine.
Which row has negative one? That Means Empty Which one is it? Correct? So the empty space will be I will go there and put my value.
And after putting what I'm gonna be doing I'm gonna break that particular loop.
That's something I can do. Correct?
Store the parameter in the correct position in Hash table. Ok? You Can Assume They Will Be No More Than 10 Objects Easy. I think That's doable as well. Ok? Def Insert What does the data say in Just? record is a Takes parameters. Let's just call it. End tex An object of type record. Let's Just call it record data.
Correct. Taking a record as a Parameters.
Ok. Then what does he do after this? Let's Let's make it global. Ok? That's Outside The Loop Outside the Procedure Function Procedure Whatever. Ok. What are you doing after this?
Global hash table. You called out to Array.
What will we do after calling array?
Calculate the hash value for the parameter using the we we The hash value has to be calculated using the Appropriate function ok so the record came na Now I have to get it from the record, okay okay ok ok a first step step one Calculate hash key that is going to be my row number which My row number will be made and then I will just have to Find the column. Ok? perfect. So, for That's what I'm gonna be doing is a we have A function known as a hash. So, We Need the Key Ah let's call it record key is equals to Go to the record data that we just recorded Must have found it. Do we have a key for that? I Can just do it directly right? Because It's a record data type dot key can Are. It's easy brother. It's done easy. If Record Key Is Equals to Record Data Dot key. What should I do now? of hashes This has to be passed into the function. Isn't it? Is No? Isn't it? Isn't it? Isn't it? Isn't it? Isn't it?
Isn't it? Let's call it hash key.
Now to extract the hash key I need to calculate the hash key.
This will have to be passed into the function. your own of records we have extracted into our array From that in the record. Hey I'm a genius Elder brother. Hash has arrived to you. Now I What is the plan? This Is Going to Be My Row Number. Let's just write it over here. These My row number will be created. Now I need to be specific Find the column. Now Need to Find Need to find column to find column. Now Figure out how to find the column.
Of? Start from zero. then on the forest Go, then go to two, go to three. Where Put it wherever you find empty space. It is easy Went. Replacing the entire value Two. So to find the right place I'm supposing Scenario with two use negative one. that where Wherever you find a negative one, replace it.
Have to do it. So for that and I'm gonna be doing per x in range I will have to check it 10 times and I I'll break as soon as I find a place.
You can use a flag looping a well in this.
If go to hash table.
And what if I do a little bit longer so I understood things. what i should do is me The record should be raised. Column Record Lyrics Let's give it to him. Column Record Equ Hash Go to the table.
Go there and type in the #sh you just generated.
That's going to be your row number. And Going to his exes one by one from the letters Going to column number one, we picked up the record.
else if if column record The dot key which is its key, if it is negative one In that scenario you are supposed to To say that you have got free space. So What do you have to do? You can use a hash table You will go.
You will go to your hash meaning cry. whenever you You will go to the place where you have found it and keep your You will get the records stored. be a genius Brother is gone. And when you store the record You will get it done then you are just suppose to break It. Simple if you are using a for loop then Just make a flag ojit. Simple that's it.
It's easy brother Sam. It's done easy. It appears to me Looks like that's perfect.
Ok. What is Part E telling us now?
Inside? I am asking you to create the file #sh table date dotxt what is this brother? What is this, tell me brother?
table daughtertxt okay so this is comma separated So that means we will have to use split.
The function of split is to create arrays.
I give it, it has been used many times now. So That's something which you guys are used to Now Stores 200 Key Values and String Data items in the format of commas String. For example, the first row in the Text file is 528 comma permission. The Key Is 528 and the string data is permission. The Procedure ReadData. You have a procedure Create a Read Data Named Which Opens The Text File A file reads each line one by one Reed will split each line into the key and will divide the array into data keys and data Will do dot split calls through InsertData will then call InsertData putting the entire record in it containing each key and matching data That's right, you'll make a record with it.
By creating the entire insert inside the data If you keep passing then that's something what we Are suppose to okay okay perfect perfect Perfect Perfect Perfect Perfect Kids is the work of read dada read dada read dada read d no Parameter Perfect Exception Handling OK File work File is equal to own file name file name file name file The name of the file is the name of the table data.xt Hash table data Comma read mode After That What Else Do You Need for line in file Because the lines have to be read one by one.
We Let's call it data is equal line dot strip newline character removed dot Split. Split it. But Make sure to put a comma here. Correct?
That's a silly mistake that I did in the Last paper as well. So make sure to know Learn from your silly mistakes so that you Remember that thing. So the last time I did this If it was not done then the code itself would have been wrong.
So that's something you should do. comma If there are separated values then you should enter comma.
It is necessary so that it is comma based.
Do the split. Now there are two things inside the data.
Must have been done. Index position zero of the data Your key will be present on it but these strings Format. So you should make sure to convert That into integer. because the values of a will be converted to integer. Data Pay I will go. The index will go to position zero.
I will pick up the value from there. And After That Let's go with the string value that is our is present. that should be similar No conversion of data types required.
The index will move to position one. from there Will pick up the value. fixed bugs? Record Now Have to make it. Let's Just Make a New Record Equals to record data type. the first of all If he had asked for something, we would have given it to him.
Isco and after giving it the key I need the String value then String value also If we give it to him then the record is made now I am Just suppose to call insert data We have passed a new record in this.
Insert Data New Record OK you did what did you do, kept entering data, kept entering data It's perfect, then you changed your for loop.
exit file dot close key After closing the file, what are you Supposed to do is Exception Handling Accept IO Error print File There Is No Acist After That's What Do You Need I Think That's It's understandable now, making us is the function Gate Records Tex N Get Records is to be made. Tex N Integer key field as a parameter calculates The hash value for the key field using the Appropriate Function Takes an Integer Key Field as a parameter. Good one's field will take as a parameter. one second takes n Integer key field as a parameter. good that The field will calculate the hash value for The Key Field Using the Appropriate Function Searches the hash table for the record with the The matching key field returns the data for the Record If the Record Is Found Return Is Not Found If the Record Is Not Found I Don't get it wait a minute but the key field can Be Repeated So What's the Point Then Takes an integer key field as a parameter An integer field is used as a parameter.
Calculate the hash value for whatever the key is.
That like must have come to us from him.
Will find the value. Ok? Like Hash Key Will find it. Search is the hash table for the Record with the matching key field. so that Have to go to the field and find him.
Returns the data for the record if the The record is found. If you get the record What should you do if you go?
It's a Key Field Could Be Different Key fields could be different right okay yes yes Yes Yes Yes Yes Hash Key Can Be Same But the Key Field can be different right that will be unique Got it now I understand I was a little confused It was like what is he trying to say?
Yes brother because look this is 528 that's the key Right, this hash can be the same as the one that row The index coming up may be the same but The keys will of course be unique.
No. OK got it. So then he tells us first I can find the row number by looking up the hash key.
Will go. Then I search in the column one by one I will do it and I will find his key.
It became perfect and easy. When I get his key will go and if there is a match then I am supposed to Say I'm Just Supposed to Return What?
Returns the data. So I put that record I will pick it up. I will only access its data.
Which is going to be your dot data kar The value will come to me. Correct? Data comes Will go. And then after that what I am suppose If I don't get it from two and the whole The for loop ended in that scenario.
I'm just supposed to do what I'm just Supposed to return not found then what I I'm gonna be doing I'm gonna be doing Complete search and then linear like We do the searching by doing a linear search of all Columns found To find columns After if not found return loop inside itself and if not found then from the loop I will go out and return it not found.
That means what if the loop is finished running If nothing happened then at the end nothing Found will be returning. with children The work is over. OK got it. I understand brother.
Allahu Akbar. That's such a fun question. Gate Record. Inside the gate record, you will You are looking for it, let's ask for a search.
He has it. That's the key that I'm trying To find. Let's say search. Now search That I need to extract its hash key. Let's Call it search hash.
We have a function search# =# which Meaning in finding our key#sh key Will help you find it. Correct? So from this I will know the row number. which is Going to be my row number. Let's Just Call It row number. This is going to give me my The row number I need to find. Ok?
Row number. And After That What Do I Need?
A What Else Do I Need? Search# = # of searches The row number has arrived. Now I need to put a for loop again You have to search, right? So for column in range There are 10 columns. Now let me go to this row need to find. then if #sh table A What should I do? What should I do? What should I do? What should I? Go to this search hash row.
Put column x. We will find them one by one. From this You will get the record. Right? So let's just Go with a variable Create a search record by name.
Go to the search record equals to hash table.
Go to your search hash row. X Pay Go. You will get the search record. Now What do I have to do? If Search Record Dot Data No, not, not to compare with data.
Right if search record Dot E Is equal to equal to search key perfect now I feel right if we have a search key In that scenario what I am Supposed to do I'm just supposed to return That Particular Record Returns Search records that we just accessed.
Return what you did. Don't make this mistake Do that by writing Else here and doing the work.
So this is wrong because let's say if If it was not there in the previous one then it automatically Will return not found. So this is Wrong. Always search the entire column first Done it on 10th. Then if it is not found then That scenario you are supposed to say no return Found. So get out of the loop.
Now who is not found here?
Is this correct? Oh my back. One mistake. it We named the column. Here I put x Gave. So that's the mistake.
Ok? Return not wrong. Search#sh equals two We will get the search key from which we will get the value Will go. Then we go through the columns one by one Will find. Will pick up the record. to his We will see. If the search key matches, it will come M Supposed to return search record. No Eye Am not supposed to return search record. I I am supposed to return the data. So I am Ganna be calling it search record dot data.
I will have to return this. Right?
perfect. That's it. What is the matter. Hopefully It Works. I don't know. I am not sure.
The Main Program Calls initialize The main program calls initialize the hash table.
First you need to call initializeHashTable Will have to. Ok? And then read the data.
Call initializeHashTable.
Then call Read Data.
This was followed by What Else Do We Need? we are saying has five integer key fields as Input from the user. Five Key Fields Lennie is these integers.
Correct? Then you have called Calls Get Record With Each input and output give the return values.
So what do you do? The output is to to the return values.
Calls Gate Records. Ok? Ok. let's do it Brother. Well, it's done. Five integers. Five integers in range x Five what are we saying? Ah five integers OK key fields have to be taken. Right? Key Fields Let's Just Call It Key Fields Fields Is equal to integer input the enter key Enter the key. Let's call it. Enter the key.
After that Ah calls get recorded with each Input. What does Get Record do? no one It returns a value, right? So let's Make a variable result.
In this, we call the gate record and the gate He takes the record from you.
Key Fields. Ok? And accordingly we I have been asked to print this value. End output Print result.
Ok?
OK Test Program with the Following Five Inputs in the Order Given I am getting an error brother, please enter the key 528 Permission We are 1128 Grind 106 2 not found 1062 is not 39 not found so Two Not Found are coming Did I miss something? I miss that 18828 One. Let's do it again.
Run to the Key 528 11282828 Not Found 1062 Not Found 39 Not Found. ok let me Verify My Answer Marking Scheme.
What is the answer brother? Is it the same?
Okay, let's just quickly look into that. 528 Permission 1128 pieces 18828 Wet 188 What is he doing? 1062 One second, friend.
1828 Pay Its Saying According to the Marking Scheme It's Saying 528 Permission End to the Key Field 1128 Pieces 18828 Pay It's Saying President Ours is coming not found right so there Is there something wrong with our code?
We'll have to find him, then he's on 1062.
saying up And then at 39 it is saying not found. So These final values of ours are coming Yes, these are wrong. Their answer is not expected a like according to the Marking Scheme. Right? So, I have nothing Something will have to be seen. Inside this we have some I have not done anything wrong. Due to which it Saying not found. So when does Not Found come out?
when we have Ok What could be the mistake?
I have entered the values correctly. Let's just Quickly verify the values again brother.
Five Inputs 528 These two are coming to us properly. 1128 these It is also coming right. Then 1828 This is giving not found. y is 1828 not Found. 1062 Not found. 39 Not Found. So these three Values are wrong. ok, let's try to Figure it out. Let's find out what we did wrong has done.
Could it be given Initial Are mistakes that we are making.
Let us check our answers here.
Okay, now you can ask this question. Sir You have seen it from the marking scheme.
How do we figure that out? from your file You will see like 1828, see where it is.
In this? 1828 And We Will Try to Figure It Out out 18282828 You can search as well as you want your file to be.
You can also go and search there. So in 1828 We should meet 1062 Pay Up should be available. Right? So this something which is wrong that we are doing Are. So we need to figure it out. Ok?
Let's start. Let's start from Scratch. And one by one we look at things Are. Could it be the initialization?
I think so no. Because we made a We created a complete empty row and inside it we Values have been entered. perfect. And what did you do next? for x in range Made a record and kept putting one in it.
Correct. what did you do then? for y in range and then you For y in range and kept putting 100. Correct Is? Meaning it was made 100 times a day and it was completely finished.
You added 100 times daily and you completed it.
Complete. Right?
Ok? That's perfect. Then you Modulus done. Let Me Just Rethink About Dec. You picked a hash table. Inside it you I cried completely. That's an empty array.
Put a whole forest array in it Gave. One is Van de Aare. Then the second one DR Is. Then the third one is D R. then fourth one fifth Forest de Aare. That's perfect. So no reason That. Ok?
We Then Where is the issue coming from? Let's Just Quickly Verify that.
Def# Key Modulus 100 That's perfect as well.
Let's look at insert data. So here We have not made a mistake. Good insert data You made a record inside Data Dot Key We took the record data and took the #sh table We took the record from him From the record that came, it is correct, let's We have received a key from and from that we Equ hash of created hash of recorded correct record key... We picked it up and made hash. Now need to Find column for x in range 10. column Record is equal to We use the column recordIsEquals to set the #sh table on Went.
You went to the hash table. Then after that you What did you do? The hash key that was just generated Went to the row and went to that column.
Column Record#sh went to the table#sh that you go to the line that has been generated by you You went to the column before lats and went there.
checked column record dot key did that equals negative one if then hash Go to the table Go to the hash key Go to the same row Go to X and there the whole put the record on right we're okay give me a minutes Okay, I went to column record dot key.
Negative one came, you went to hash cable and You broke him, that means you broke him.
I inserted it in the right place, okay?
I don't see any issues with inserting data.
Okay, now let's look into death and read data.
Now open the file for line in file Kept doing line, dot, strip, kept splitting You went to the value of and you collected your data From the string value you picked up the value new You raised the record, New Record Equals To Record Key Value Comma String value then what did you do new record Equ to Record Key Value Comma String You inserted your new value.
record Inside Insert Data you have added the new record All that work was passed automatically will close the file and print it Diya Perfect now let's look at the gate record Brother, something is wrong, oh my god Father So you searched for Def Gate Records.
The search branch that we are currently inputting.
You put 5 to 8 from let's. from that 5 to 8 Your modulus came from let's. Correct? You Went to that modulus and that particular column You went to and after going to the column you have now Started searching for him. Inside the columns You got the row number. Search Records EqualsTo#sh table record Search Record Equ To#sh You went to the table and you went to the search hash that you just The hash has been extracted and the row number has been obtained.
If you keep going to the columns one by one, search Record Dot Key The search key is equal to What we're looking for Let's Say 1828 Then You Are supposed to search records.data And if not, then you are supposed to retire.
Not Found exited the loop Hum to agar not found aa raha hai that means woh If you can't find it, let's do one thing.
Let's do one thing, let's do it manually.
People, please try doing this manually.
If true then we initialized the hash table I've done it, I'm removing it now.
removing the code and giving me the man man manually doing things and then checking Will have to. First thing, let's figure out the issue.
Where are you coming from? We are facing issue 1828 Inside. So let's try to find the right one Number first. Let's find its row number.
First, I need to look at our array.
Is the value going away or not? by the They are a very good example for debugging.
Right? Now I have to debug it. I don't I understand what the mistake is. So let's figure It's out. You might be making a basic mistake.
yes. It is possible Let's just see that Whether our value came into it or not.
We need to see this as well. Correct? So Let's do one thing. Let's try to find the Row number first. manually extracting row numbers Are. we we we 1828 A Test Key Is Equ Too#sh And let's put 1828 inside it.
Correct? Let's print this.
What is this coming out of our test? Let's Run this code. Now I ran the code. So I have a test coming up on 28th. So it means By going to row number 28 you have added this 18828 The record must be stored. Correct? Or Let's do 1062 because that was the last one na, so that's easy to find let's do Dec 1062? We got this, right? So this We do the same. Let's do 1062. Why is it Saying not found.
1062, okay? So this should be in row number Row number 62 Go to row number 62 and then You have to run the code accordingly. Ok?
perfect. So according to this row number I Forgot Let Me Just Quickly Reign. Row Number 20 62. Ok? perfect. Remember row number 62 You guys. Let's write it down here. Correct Is? Row No. 62. ok what do I do now Is? Ah I want to verify row number 62 62 What are the values on it? let's do that First. So, what I'm gonna be doing for x in range 10 Times I have to run columns. Then I want to know about array of hash tables and its Have to go to row number 62. and its column number I have to go to everything one by one. And the first thing What do I need to pick up from here? I suppose to do the data first data is equal Table 62x dot data and then We Test One Equals Two Let's Just Call It MMM M Keys let's call it keys equals to#sh table I have to go to row number 62, x I have to go to We did it by doing the dot key.
Have to pick it up. Correct? Now we print it do. print Data Colon A Data Comma Keys Keys Colon Keyed values. This makes me cry all the time We will find out what is happening in the Row. So If we see something wrong here, we will Let's figure out what the scene is brother.
Let's see the answers now.
Look at this. This was our complete cry and On this one we have to figure out where 1062 is.
Is.
1 2 3 4 5 6 7 8 9 10 This is 10 values.
and according to 10 It's Working Right The Is Not Being Stuck Here.
There is no 1062 in this. And this has to be I want it on roll number 62. That Means Your The marking scheme is wrong.
Correct. Because what did he tell us?
Yes, their marking scheme itself is wrong. Got It.
I will tell you the reason for that. See 1062 which That should be in row number 62.
Brother? According to the data 1062 pe hona He needs it. But it's not there. The Reason Is let me tell you why.
We have only 10 columns.
Right? Because there are 10 columns. So that's the The region can only store those 10 records.
Can. According to the question within what he has told us here There can be only 10 columns. These Just look. There can be up to 10 columns. So these that scenario There should not be more than 10 columns. So Let's do one thing. They have another one here The thing told us that it was more than 10 It cannot happen.
Right program code to declare the global To d array initialize ok insert data yes You can assume you guys just read this line With me. You can assume there will be no More than 10 objects that generate the same Hash value. And great men gave more than 10 The objects are given inside the file. So That's a wrong question at all. Complete The question itself is wrong. The marking scheme itself This is wrong. Is it okay? Come on, let's Verify One More Thing That We Value She is coming, if that is correct, let's Let's verify one more thing, I just need this I have to pick them all up, I have to check them properly.
It's 5 to 8, let's modulate it.
Make a new file now Create another file here So let's look at it properly now, let's test it.
I am creating a file named dotpy now.
Inside this I have all my things one by one.
By doing this we are getting answers Here I will verify my bad unko.
The first one is I have a 528 maybe I'm Wrong can be right. So at 62 we have How is 528 going to pass row number 62?
That's Wrong Right There might be a possibility question is correct.
I am the one who is wrong.
Print it.
528 M 100 What is the answer to this? I Wa C December 28th is coming. So that's wrong na hum Are wrong. So that's our mistake.
That's our mistake. So that row number is correct.
I could no longer control myself.
We are interesting and interesting.
That Should Be in Row 28? Why is it on the road?
62?
And do 1248, just 1 48 The modulus is 100, so it should have been 48.
It should have been at 48 and it is at 62 He is sitting like this, isn't he?
Verify this, see row number 62 62 pe roma column na to row number 62 pe hona should have been at 48 but it On the Wrong Position That means what? So our gate is on record.
It is not an issue. I think our inserts I find the issue in the record.
Isn't it?
I feel like we should insert We're messing around with the record.
Could it be your array is wrong? Let's Do One More Thing. Let me try to change my Initialize. Change the initial hash table Let's try it.
We Let's do one thing. The hash table is shown here Re-evaluate. And apply a for loop. for x In range. I need to verify one more thing.
100 Because there are 100 days.
Make rows in it one by one. Row Equ Y in range 10 Row Dot Append record Negative One Commutation Mights I feel like in initialize It could also be a mistake. OK and then what do I need? What do I need? what do i Need?
Let us keep appending. Now exit the for loop.
Go to the hash table here. Append the dot.
This entire cry. Let's verify the Code Now.
Let's verify the code now. Let's See How It Is Cow.
Now I got it. Yes That Was The Mistake.
I understood. So the question was not wrong.
It was our mistake in initialization.
There was an issue inside. Now let's check it out Why did this thing happen? In my thought Let's do one thing which was being made every day.
Let's copy it and then let's do our Let's visualize the array behind.
So I have to make a mistake in the rest of the code.
I can't seem to. So whatever happens, it will be in this only.
There is something wrong. Give me a minute. well what is this Did we do it?
We are doing a job. We are the complete Picking up the record and appending it There are one by one inside the everyday. Correct? When It becomes your cry, we cry the same cry Appending inside hash table 100 times Are. So that should make 200 daily.
Isn't it? So in my opinion for v in range 100#sh will go into the table I will keep putting the entire row in #sh Table lot up and row#sh Table lot up and row one second Row equal to empty square brackets Okay, we made the whole row and that picking up the entire row ok got it I understand here what we You are making a mistake by appending this dot.
This is a way of expressing those values of yours.
means same location So he is duplicating the values So that different rose is not actually made from it.
As for that, there is only one row and reference to that row.
If he is doing it again and again then that is wrong approach so the right approach is going to be Regarding let me just Paste It Over Here First This should be the case in which we, one by one, We will make them all every day and a new one every time.
will generate rows. So hash table equals to Empty array for xn range 100 so we can We will go over each element and its You will have to make separate roses for this. when you After that you will make different roses in each one.
Go and you have to do #sh table dot app and row.
Every day new things will be made for her.
inside because this is a Python issue in which Python is what you guys need to know about memory.
What does Na do to save? same goes to the index element and there He then duplicates it. one and the same By storing it at the same location, it is inside the ares He makes a duplicate of it. Instead of Making it a completely new row. the same cry I made it and kept duplicating it. So That's a wrong approach. Ok? I think this Should work now. Let's Just Redo Our Code Now that was our last part.
Hopefully it works. If it doesn't work we Will figure it out again. No Waz. So just this That's the whole game. You figure out errors Learn to do it yourself. and the mistakes that have been made Improve with them. Like it's my fault What was there in this whole scenario? I have used this I did not even keep in mind that brother, he There is also a duplicate. So I should you know Be careful with that. We Test Program with the Following Five Inputs and the Order Given. let's do that First. Called initializeHashTable.
Reed called. Tex Five Integer Key Fields as input from the user. Ok, Let's do that.
Hopefully it works. If it doesn't work, then someone It is not an issue. We'll figure it out again.
for x range Five What do we have after that? Tex Five integer key fields as input from the User calls get recorded with each input and Outputs the return value. Correct? whatever Your value will come and we will also get its output.
We have to do it together. Ok? So for that What I'm Gonna Be Doing? Let's Tech User mmmmmmmm a hmmm user ki bol We give.
Integer is required the enter key And after that is what I am supposed to do Let's call it result equal to get record call to And pass the user key inside it. result Equipped to cut a record for the user's perfect end.
Now I am suppose to print the result Hopefully This Works and If It Doesn't We Will figure it out again, no one has such a big issue No, I think that's the mistake.
Please do your work my brother 528 Permissions OK that's correct 1128 Peace Peace Please Please Peace 1828 President OK 1062 to 1062 up ok 39 not f Okay brother, this is how you should figure out errors.
This Is How You Should Validate Your Logics This Is How You Should Look Into Your Mistakes That brother, I went and looked in my file 1062 If it is up then this is completely wrong I created a new file and went into it.
I looked at my file to verify that Brother, something is going wrong, then we I told the examiner a little bit that brother He got the questions wrong, but that's that.
The Wrong Approach A Well So After That We What did people do? to see everything After that, I took all the things one by one.
I verified that there is no mistake in it brother.
Was not there. There was no mistake in this.
There seems to be no issue with inserting data.
Me. Was there any mistake in this? Now What's left in the end? When I took my data I printed it and saw that of course there was no There was something wrong that it was not more than 10.
Can. So that means my initialization I was mistaken. And that started me off I also felt that something was going wrong Is. So that's it. This is your complete This is the scenario. So what do we learn from this?
Can I get it? That is you should never just say Use a single row and then have it appended instead of You Should Make a New Row Every Single Time. That's right sir. So that's it. that's it With the code completely done. Question one, Question two, question three. Let's pause the Recording and that's it. Take care.
Allah half chops.
Ähnliche Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
So What's Odin Lang Even Good For
TechOverTea
131 views•2026-06-01











