DEV Community

Cover image for EdPresso Roundup: Top 5 flavors
Amanda Fawcett for Educative

Posted on • Originally published at educative.io

EdPresso Roundup: Top 5 flavors

EdPresso shots are a new kind of Espresso shot but, instead of waking your body up with caffeine, they wake your mind up with knowledge. Just like shots of espresso, EdPresso shots are short and concentrated bits of coding knowledge, organized in an open-access library for developers of all skill levels. The time it takes to read one rarely exceeds four minutes, no matter the difficulty of the topic.

Also, like espresso shots, EdPressos come in many different flavors, some more popular than others. There are five shots that seem to have won over developers around the world. In this post, we will explore the top 5 questions searched by developers like you.


1. What is Object-Oriented Programming?

First, we define the difference between classes and objects: "an Object may contain data (fields or variables) or code (methods or procedures). The creation of these objects is based on a programmer-defined blue-print also known as a Class." This shot then breaks down the four basic principles of OOP (Object-oriented programming): inheritance, polymorphism, abstraction, and encapsulation.

Alt Text

Since languages like Java, Smalltalk, Python, Fortran, Eiffel, etc. all use OOP, it makes a lot of sense that so many developers are curious about this shot.


2. What are some basic UNIX commands?

The shot begins with a short definition of a command: is an instruction to the computer, which it interprets to perform a specific task. It then breaks down commands in detail, including Listing Files ls, Change Directory cd, Make Directory mkdir, Remove Film rm, and Manual man. Under each command header, there is an explanation of why the command is used and a real-life example that you can compile on the webpage yourself. Learn these basic commands to get started with the command line. For a comprehensive list of UNIX commands, you can visit this Bash cheat sheet.

Alt Text


3. How do you reverse a string in Python?

Number 3 beings by defining strings: ordered sequences of character data. In Python, there is no built-in method to reverse a string, but there are three different ways in which strings can be reversed (i.e., Slicing, Loop, and Use join). With Slicing, we simply create a slice that starts with the length of the string, and ends at index 0. With Loop, we create a new array called reversedString[] and then loop over the list with iterating variable index initialized with the length of the list. With Use join, we use reverse iteration with the reversed( ) built-in function to cycle through the elements in the string in reverse order and then use .join() method to merge them. If you want to get hands-on practice, take a look at shot and run the code in real-time.

Alt Text


4. How to use switch case statement in Java

First, we define a switch statement: these are is used to transfer control to a particular block of code, based on the value of the variable being tested. They are an efficient alternative for if-else statements. The switch is passed a variable, the value of which is compared with each case value. If there is a match, the corresponding block of code is executed.

Alt Text

Try this powerful alternative to the if-else statement in real time.

Alt Text


5. Min Heap vs. Max Heap

This shot compares min and max heap with clear visuals and applications.

Alt Text

It then breaks down the time complexity for each.

  • Get Max or Min Element: The Time Complexity of this operation is O(1).
  • Remove Max or Min Element: The time complexity of this operation is O(Log n) because we need to maintain the max/mix at their root node, which takes Log n operations.
  • Insert an Element: Time Complexity of this operation is O(Log n) because we insert the value at the end of the tree and traverse up to remove violated property of min/max heap.

You can learn more about this topic here.

Top comments (0)