Skip to content

Instantly share code, notes, and snippets.

View HallexCosta's full-sized avatar
:octocat:
Learning on-demand!

Hállex da Silva Costa HallexCosta

:octocat:
Learning on-demand!
View GitHub Profile
@HallexCosta
HallexCosta / binary-tree-search-data-structure.ts
Last active November 10, 2020 22:39
Example of binary tree search data structure with TypeScript
type DataStructure = {
value: number
branchRight: DataStructure
branchLeft: DataStructure
}
class Tree {
private static data: DataStructure
constructor() {
@HallexCosta
HallexCosta / binary-tree-data-structure.js
Last active November 16, 2020 03:48
Example of use the binary tree data structure with JavaScript
const tree = {}
function add(tree, value) {
if (tree.value) {
if (value > tree.value) {
add(tree.right, value)
} else {
add(tree.left, value)
}
} else {
@HallexCosta
HallexCosta / methods-receptor.go
Last active November 7, 2020 19:54
Example usage method with receiver in golang
package main
import (
"fmt"
)
type User struct {
Name string
}