This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# MIT License | |
# Copyright (c) 2023 Ivan Koblik | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bst; | |
public interface BST<T extends Comparable<T>> { | |
/** | |
* Returns the value of the current node. | |
*/ | |
public T getValue(); | |
/** | |
* Returns the left child node or null if there isn't one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.assertTrue; | |
import java.util.concurrent.CountDownLatch; | |
import net.engio.mbassy.common.StrongConcurrentSet; | |
import org.junit.Test; | |
public class TestConcurrency { | |
/** | |
* In this test HashMap will cross capacity threshold multiple times in | |
* different directions which will trigger rehashing. Because rehashing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns koblik.scc) | |
(defn dfs | |
"Depth first search. Short form of the method passes through all the | |
nodes of the graph even if it's disconnected . | |
(nodes-fn graph) expected to return list of all the nodes in the graph. | |
(child-fn graph node) expected to return list of all the nodes linked | |
to the given node. | |
Returns hash-map where nodes are associated with a pair :idx, :leader. | |
:idx stores finishing index of the node traversal (post-order counter) | |
:leader first finishing index of the current DFS." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn test [args] | |
(filter #(> % 5) args)) |