DEV Community

Cover image for I try to explain CS concepts in simple terms
Isaac Smith
Isaac Smith

Posted on

I try to explain CS concepts in simple terms

Algorithm

A finite set of instructions called an algorithm is utilized to solve a certain task. Because they are designed to solve a problem, most computer programs are also considered algorithms. Algorithms are an important component of computers; they are used in anything from solving mathematical problems to recommendation systems. Algorithm efficiency is determined by how much memory they consume and how long it takes them to finish a task. Searching and sorting algorithms are the most popular types of algorithms. The linear search algorithm is an example of an algorithm: This technique is used to find a specific item in a sorted list of items, such as a phone book. The algorithm checks the first item to see if it's the one we're looking for, and if it's not, it moves on to the next and checks again. This is a very slow process, which is terrible for an algorithm. There are algorithms that use a better search technique, such as divide and conquer.

Control structure

A control structure is a piece of code that enables programs to make choices while they are running. Programs don't always run in a straight path; a change in a value can cause the program to branch or even skip entire blocks of code. Conditionals and loops are the most basic control structures in programming. Conditionals, which are denoted by If or If-Else statements, execute a block of code when a given condition is met, either by user input or by the internal state of the program at runtime. When a specific condition is met, either by user input or by the program's internal state, loops cause the program to repeat the execution of a block of code a given number of times. Loops are useful because they allow you to run a block of code as many times as you need. The keywords For and While are used to indicate loops.

Class hierarchy

In object-oriented programming, a class hierarchy is a concept that defines the number of child classes a parent class can have. Assume we have a class that represents an automobile. The Automobile class can have attributes and methods that define the basic components of a car, such as the body material, the engine, the tires, and the seats. Now we can build a new instance of the Car class and have a working car model, but what if we wanted to make a different car with a different engine, tires, and entertainment systems? Then we'd have to make a new class named Lamborghini that inherits the Car class's attributes and methods. Now we may either overwrite the parent class's properties and methods or create new ones that will only belong to the Lamborghini class. The call is sent up to the parent class when we call a method built in the Car class from the Lamborghini class. This is referred to as upcasting. Many child classes can be formed, either from the parent class or from another child class, resulting in a tree of classes with their own attributes and methods.

Flowchart

A flowchart is a diagram that depicts the stages involved in solving an issue. Algorithms can be described using flowcharts in a step-by-step manner. A rectangular or diamond-shaped box can be used to connect the steps in a flowchart chart, and an arrow can be used to connect them to another step. Flowcharts can be used to document or assess a process in addition to describing algorithms. The diamond boxes normally indicate a decision, while the rectangle bounding boxes usually reflect an activity. A cross-functional flowchart is one in which the chart is broken into separate vertical or horizontal segments that describe the control of various organizational units. A cross-functional flowchart enables the author to correctly identify who is responsible for executing an action or making a decision, as well as to explain how each organizational unit is responsible for different aspects of a single process.

Top comments (0)