You are on page 1of 5

FINAL REPORT

EXC-1011 – SKILLS IN COMPETITIVE CODING


under
CodeChef-VIT
By

RAJAT SABLOK (18BME0827)


COMPETITIVE CODING SESSIONS
What is a Data Structure?

Simply put, a data structure is a container that stores data in a specific layout. This “layout” allows a
data structure to be efficient in some operations and inefficient in others. Your goal is to understand
data structures so that you can pick the data structure that’s most optimal for the problem at hand.
Why do we need Data Structures? As data structures are used to store data in an organized form,
and since data is the most crucial entity in computer science, the true worth of data structures is
clear. No matter what problem are you solving, in one way or another you have to deal with data —
whether it’s an employee’s salary, stock prices, a grocery list, or even a simple telephone directory.
Based on different scenarios, data needs to be stored in a specific format. We have a handful of data
structures that cover our need to store data in different formats.

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 (as shown above) 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

Recursion
Recursion means "defining a problem in terms of itself". This can be a very powerful tool in writing
algorithms. Recursion comes directly from Mathematics, where there are many examples of
expressions written in terms of themselves.

For example, the Fibonacci sequence is defined as:

F(i) = F(i-1) + F(i-2)

There are three steps to solve a problem using Recursion, by breaking it into –

• Base condition
• Hypothesis
• Induction

The most popular example of recursion is the calculation of the factorial. Mathematically the
factorial is defined as: n! = n * (n-1)!

While we can implement factorial using a loop, its recursive function involves successively calling it
by decrementing the number until it reaches 1. The following is a recursive function to calculate the
factorial in python.

Code

def factorial(n):

if n == 1:

print(n)

return 1
else:

print (n,'*', end=' ')

return n * factorial(n-1)

n=int(input(“Enter a number ”))

factorial(n)

Output (n=5)

Enter a number 5

5*4*3*2*1

120

When the factorial function is called with 5 as argument, successive calls to the same function are
placed, while reducing the value of 5. Functions start returning to their earlier call after the
argument reaches 1. The return value of the first call is a cumulative product of the return values of
all calls.

ONLINE WEBINARS
A lot of webinars were conducted by club members on various web technologies such as Cloud
Security, JavaScripts related webinars on nodejs and reactjs, competitive coding , mongodb ,
express.

Cloud Security

This guest lecture was delivered by Ratika Singh and Amit Malhotra (IHS Markit).

Cyber security is the practice of protecting systems, networks, and programs from digital attacks.
These cyber attacks are usually aimed at accessing, changing, or destroying sensitive information;
extorting money from users; or interrupting normal business processes.

Some of the important topics introduced and delved into during the webinar were -

1. What is virtualization?
2. How it is essential for cloud security?
3. Abstaction and orchestration
4. Private cloud vs public cloud services
5. Responsibility Matrix
Don’t REST, Let’s GraphQL!

GraphQL is an open-source data query and manipulation language for APIs, and a runtime for
fulfilling queries with existing data. GraphQL was developed internally by Facebook in 2012 before
being publicly released in 2015.

In this webinar we learnt about graphql. It was a live webinar hosted on youtube. Some of the
reason for using graphql is mentioned below:

● Over-fetching of data is prevented


● Auto generated Documentation due to its typed nature.
● Version – free.
● Best part – works with most of the server side languages.

Building your portfolio - using React JS by Madhav Bahl

Madhav Bahl, who is currently working at Microsoft as a SWE, was invited by CodeChef VIT to give a
lecture on the importance of having a portfolio website and how to build one using React JS, one of
the most popular JS frameworks. The portfolio website can be used to showcase your projects and
also your command over web development. It does not need to be too flashy but it should be clean
and contain the important contents like skills, projects, resume. After walking through the project
here are the things which can be improved

● Add experience section


● Add portfolio links at the bottom of SideNav
● Use a common card element for all the cards (prevent duplicate code)
● Use an enum for selected Section
● Enhance the view for small screen.
● Use local storage to save the active session.

You might also like