0% found this document useful (0 votes)
103 views5 pages

Final Report Exc-1011 - Skills in Competitive Coding Under Codechef-Vit by Madhur Gopal Goel (19bce2100)

This document summarizes Madhur Gopal Goel's final report on skills in competitive coding. It discusses various data structures like arrays, stacks, queues and dynamic programming. It provides examples and basic operations of each data structure. It also summarizes two online webinars conducted by CodeChef VIT on building functional web apps and code optimization and debugging.

Uploaded by

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

Final Report Exc-1011 - Skills in Competitive Coding Under Codechef-Vit by Madhur Gopal Goel (19bce2100)

This document summarizes Madhur Gopal Goel's final report on skills in competitive coding. It discusses various data structures like arrays, stacks, queues and dynamic programming. It provides examples and basic operations of each data structure. It also summarizes two online webinars conducted by CodeChef VIT on building functional web apps and code optimization and debugging.

Uploaded by

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

FINAL REPORT

EXC-1011 – SKILLS IN COMPETITIVE CODING


under
CodeChef-VIT
By
Madhur Gopal Goel (19BCE2100)
COMPETITIVE CODING SESSIONS

What is a Data Structure?


The data structure name indicates itself that organizing the data in memory.
There are many ways of organizing the data in the memory as we have already
seen one of the data structures, i.e., array in C language. Array is a collection of
memory elements in which data is stored sequentially, i.e., one after another.
In other words, we can say that array stores the elements in a continuous
manner. This organization of data is done with the help of an array of data
structures. There are also other ways to organize the data in memory

Arrays
An array is the simplest and most widely used data structure. Other data
structures like stacks and queues are derived from arrays. Each data element is
assigned a positive numerical value called the Index, which corresponds to the
position of that item in the array. The majority of languages define the starting
index of the array as 0. The following are the two types of arrays:
• One-dimensional arrays
• Multi-dimensional arrays (arrays within arrays)

Basic Operations on Arrays:


• Insert — Inserts an element at a given index
• Get — Returns the element at a given index
• Delete — Deletes an element at a given index
• Size — Gets the total number of elements in an array

Stacks
We are all familiar with the famous Undo option, which is present in almost
every application. Ever wondered how it works? The idea: you store the
previous states of your work (which are limited to a specific number) in the
memory in such an order that the last one appears first. This can’t be done just
by using arrays. That is where the Stack comes in handy. A real-life example of
Stack could be a pile of books placed in a vertical order. In order to get the
book that’s somewhere in the middle, you will need to remove all the books
placed on top of it. This is how the LIFO (Last In First Out) method works. Basic
operations of stack:
• Push — Inserts an element at the top
• Pop — Returns the top element after removing from the stack
• isEmpty — Returns true if the stack is empty
• Top — Returns the top element without removing from the stack

Queues
Similar to Stack, Queue is another linear data structure that stores the element
in a sequential manner. The only significant difference between Stack and
Queue is that instead of using the LIFO method, Queue implements the FIFO
method, which is short for First in First Out. A perfect real-life example of
Queue: a line of people waiting at a ticket booth. If a new person comes, they
will join the line from the end, not from the start — and the person standing at
the front will be the first to get the ticket and hence leave the line.
Basic operations of Queue:
• Enqueue() — Inserts an element to the end of the queue
• Dequeue() — Removes an element from the start of the queue
• isEmpty() — Returns true if the queue is empty
• Top() — Returns the first element of the queue

Dynamic Programming
Dynamic Programming is mainly an optimization over plain recursion.
Wherever we see a recursive solution that has repeated calls for same inputs,
we can optimize it using Dynamic Programming. The idea is to simply store the
results of subproblems, so that we do not have to re-compute them when
needed later. This simple optimization reduces time complexities from
exponential to polynomial. For example, if we write simple recursive solution
for Fibonacci Numbers, we get exponential time complexity and if we optimize
it by storing solutions of subproblems, time complexity reduces to linear. The
factorial of a positive integer n is equal to 1*2*3*...n. Factorial of a negative
number does not exist. Here a C++ program is given to find out the factorial of
a given input using dynamic programming.
#include <iostream>
using namespace std;
int result[1000] = {0};
int fact(int n) {
if (n >= 0) {
result[0] = 1;
for (int i = 1; i <= n; ++i)
{
result[i] = i * result[i - 1];
}
return result[n];
}
}
int main() {
int n;
while (1) {
cout<<"Enter integer to compute factorial (enter 0 to exit): ";
cin>>n;
if (n == 0)
break;
cout<<fact(n)<<endl;
}
return 0;
}

Online Webinars

Building Functional WebApps


This was a technical webinar conducted by CodeChef VIT during graVITas 2020
where we were taken through the various steps of building the frontend and
backend of our very own webapp using Node JS and MongoDB for the server-
side application.

CodeInvicta
One of these guest lecturers was Aman Dhattarwal. The webinar was light in
general and instead of being technical, we were guided on the various factors
in a successful life. Before the above mentioned webinar we also had a
technical webinar on ‘Code Optimization and Debugging’. This webinar was
conducted under the mentorship of ‘Mr. Anoop Mishra’.
We learned a lot of ways to deal with debugging.

You might also like