Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 1186

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 62k
Author
Asked: November 25, 20242024-11-25T05:49:10+00:00 2024-11-25T05:49:10+00:00

What are Data Structures in JavaScript?

  • 62k

Hey, hey hey! 🤟

Today I want to take a look into some basic JavaScript Data Structures. 🧐

Yeah, I know, it doesn't sound that fascinating but it's probably the only way to become a code master (or, at least, understand your own code a little more) 😄 .

Do you pay attention, in your daily work, to Data Structures or don't have time for this stuff, and simply you choose the simplest and fastest solution? Let me know in the comments!

Data Structure

Firstly, let’s define what Data Structure is. As the name may suggest it’s just a way to organize/structure your data. Every piece of information that is floating through the web must exist in memory with some kind of solid, logical representation.
It is crucial from the perspective of developers to know the difference between the most popular data structures because in many cases the right choice can noticeably reduce the big O complexity and speed up your app. But what actually big O is? 🤔

Big O

The big O notation is a common way to express the time complexity of an app. It’s used in the meaning of the worst-case scenario (situation when your algorithm must handle the worst possible case, for example to loop through the longest or deepest array). Two other notations (rather rarely used) are Big Omega (best case scenario) and Big Theta (average-case scenario). As you can see, developers by their nature don’t look that often on the bright side of life 😔 . There are many different types of orders (complexity types). I’ll definitely take a closer look at each one later, but for now, let’s get used to this concept and go directly to the first data structure – Stack.

Stack – Last In First Out (LIFO)

A stack is an ordered list in which the most recently added
element is the first one to remove.

The simplest implementation:

const stack = [ ]; stack.push(2); // stack is now [2] stack.push(5); // stack is now [2, 5] stack.pop( ); // stack is now [2] 

Alt Text

Queue – First In First Out (FIFO)

As you probably might guess based on the previous definition, a queue is also an ordered list but this time, the most recently added element is the last one to remove. Elements are removed in the same order as they were added.

The simplest implementation:

const queue = [ ]; queue.push(2); // queue is now [2] queue.push(5); // queue is now [2, 5] queue.shift( ); // queue is now [5]  

Alt Text

Linked List

Now, when we have the basic knowledge about the two, most fundamental data structures, let’s talk about something much more interesting.

A linked list is a structure in which each element is linked (or, in other words, has a reference) to the next node. This kind of data structure is at some points implemented, for example, in Blockchain.

Alt Text

Hash Table

The main idea behind the hash table is to speed up the process of searching and comparing elements. Each element has its own number representation that is generating using the hash function. When we want to find a particular element we can just search through the indices (which in many cases can be a lot faster and more efficient).

Alt Text

Summary

I know that this topic is probably way less interesting than for example some fancy SEO tricks and on the first look, it’s much harder to understand and put in real-life examples. You must understand, that sometimes, we all have to go through this though definitions to create strong fundamentals before we can do some real magic 🧙‍♂️. Let me know in the comments if you found this topic interesting and if you would add something to it! 🤓

Alt Text

beginnerscodenewbiejavascriptwebdev
  • 0 0 Answers
  • 6 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    ES6 - A beginners guide - Template Literals

    • 0 Answers
  • Author

    Understanding Higher Order Functions in JavaScript.

    • 0 Answers
  • Author

    Build a custom video chat app with Daily and Vue.js

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.