Reverse String Without Built-in Functions
Duration: 3 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Quantitative Ability: Speed Mathematics and Basic Mathematics, Percentage, Ratio and Proportion (Ratios), Average, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Speed Time and Distance, Number System, HCF LCM, Data Interpretation, Age Problems, Mixture and Alligation, Partnership, Algebra, Sequence and Series (Series), Mensuration and Geometry, Arithmetic
- Reasoning Ability: Puzzle Solving (Puzzles), Seating Arrangements, Coding Decoding, Blood Relations, Directions (Direction Test), Syllogisms, Data Sufficiency, Ranking, Order and Sequence, Series (Number and Letter Series) (Numerical Relations and Reasoning), Logical Sequence Of Words, Calendar, Clock, Cubes & Dices, Analytical Reasoning (Counting Figures Reasoning), Data Arrangement, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning)
- Verbal Ability: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Vocabulary, Sentence Completion (Fill in the blanks), Active Passive Voice (Voice), Direct and Indirect Speech, Subject Verb Agreement (Verb Noun Agreement), Tenses, Preposition, Articles, Sentence Correction (Error Correction)
- Programming Basics (MCQs + Interview): C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir
- OOPs (MCQs + Interview): Object Oriented Programming (OOPS)
- DBMS (MCQs + Interview): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Transaction Management, Decomposition Properties & 4NF, Concurrency Control, Database Recovery, File Organization & Indexing, Relational Algebra, Database Security & Authorization
- SQL (MCQs + Interview): SQL
- Operating Systems (MCQs + Interview): Introduction to OS, Process Management, CPU Scheduling, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Process Synchronization, Disc Scheduling, File Management, Security
- Computer Networks (MCQs + Interview): Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security, Cloud Computing and IoT, Cyber and Info Security
- Coding: Coding Questions by Yash Sir
- HR Interview: MR & HR Interview Preparation
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This video is a programming tutorial from Knowledge Gate, focusing on how to reverse a string without using built-in library functions. The instructor begins by stating the problem: 'Write a program to reverse a string without using inbuilt string reverse library functions'. He then uses a chalkboard to illustrate the concept with the string 'single', showing the process of swapping characters from the start and end of the string, moving towards the center. The core method demonstrated is the two-pointer technique, where a temporary variable is used to swap the characters at the start and end indices. The lesson transitions to a code editor, where the instructor writes a C function named 'reverseArray' that implements this logic. The function takes a character array and two integer indices, start and end, and uses a while loop to swap elements until the pointers meet. The instructor explains the code line by line, including the use of a temporary variable 'temp' to hold the value of the start character during the swap, and the increment of the start pointer and decrement of the end pointer. The video concludes with the complete, functional code for reversing a string.
Chapters
0:00 – 2:00 00:00-02:00
The video opens with the Knowledge Gate logo, followed by a title card for a programming lecture. The instructor, Yash Jain Sir, introduces the topic: 'Write a program to reverse a string without using inbuilt string reverse library functions'. He then uses a chalkboard to visually explain the concept. He writes the string 'single' and draws a box around it, then illustrates the process of reversing it by showing a curved arrow that swaps the first and last characters, then the second and second-to-last, and so on. He writes the reversed string 'elgnis' below the original to demonstrate the final result. The instructor explains that this is a common interview question and that the method involves swapping characters from the beginning and end of the string, moving towards the center.
2:00 – 3:25 02:00-03:25
The instructor transitions from the chalkboard to a code editor to implement the string reversal algorithm. He writes a C function named 'void reverseArray(char arr[], int start, int end)'. He explains the function's parameters: a character array and two integer indices. He then writes a while loop: 'while (start < end)'. Inside the loop, he demonstrates the swapping process. He first declares a temporary variable: 'int temp = arr[start];'. He then performs the swap: 'arr[start] = arr[end];' and 'arr[end] = temp;'. He explains that this is the standard way to swap two values. Finally, he increments the start pointer and decrements the end pointer: 'start++;' and 'end--;'. He concludes by showing the complete function, which efficiently reverses the string in-place.
The video provides a clear, step-by-step tutorial on reversing a string without built-in functions. It begins with a conceptual explanation using a chalkboard to illustrate the two-pointer swap method, making the logic intuitive. This is followed by a practical implementation in C, where the instructor writes and explains the code for a function that performs the reversal. The synthesis of visual demonstration and code implementation effectively teaches the core algorithm, which is a fundamental concept in programming interviews.

