- Binary Search Trees
- Queues
- Singly Linked Lists
- Undirected Unweighted Graphs
- Binary Heaps
- Directed Graphs
- Hash Tables
- Doubly Linked Lists
- Stacks
집합, 데이터 간의 관계, 또는 데이터에 적용할 수 있는 함수와 연산들을 자료 구조라고 합니다.
서로 다른 자료 구조는 각자의 강점이 있습니다. 몇몇 자료 구조는 전문화 되어 있지만 다른 몇몇 자료 구조들은 아주 흔히 쓰입니다.
개발자로써 데이터 구조를 많이 다뤄야 합니다. 이미 다양한 데이터 구조를 사용하고 있습니다. 데이터를 효율적으로 다루기 위해서는 데이터 구조를 아는게 좋습니다.
자료 구조를 보기 전에 ES2015 Class Syntax에 대해 간단히 알아봅시다.
미리 정의한 프로퍼티와 메소드를 이용해서 객체를 만들기 위한 청사진입니다.
클래스를 이용해서 자료 구조를 만들어봅시다.
class Student {
constructor(firstName, lastName, year) {
this.firstName = firstName;
this.lastName = lastName;
this.grade = year;
}
}
let firstStudent = new Student("Colt", "Steele", 2);
let secondStudent = enw Student('Blue', "Steele", 4)새로운 객체를 만들기 위해서는 new라는 키워드를 사용해야 합니다.
class Student {
constructor(firstName, lastName, year) {
this.firstName = firstName;
this.lastName = lastName;
this.grade = year;
}
fullName() {
return `Your full name is ${this.firstName} ${this.lastName}`;
}
}
let firstStudent = new Student("Colt", "Steele", 2);
let secondStudent = new Student('Blue', "Steele", 4)
firstStudent.fullName() // Your full name is Colt Steele