This file contains 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 java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestDoublyLinkedList { | |
@Test | |
public void testDoublyLinkedList(){ | |
DoublyLinkedList<Integer> list = new DoublyLinkedList<Integer>(); | |
list.addFirst(1); | |
list.addFirst(2); |
This file contains 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 java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
// 定義 | |
// 循環を含む連結リスト: 連結リストAではループを作るために、リスト内のノードの次へのポインタが以前に出現したノードを指している。 | |
// | |
// 例 | |
// 入力: A->B->C->D->E->C(最初のCと同じもの) | |
// 出力: C |
This file contains 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 java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestLinkedList { | |
@Test | |
public void testAddLists() { | |
// 617 + 295 = 912 | |
// (6->1->7) + (2->9->5) = (9->1->2) | |
LinkedList<Integer> l1 = new LinkedList<Integer>(); |
This file contains 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
#include <iostream> | |
int main() { | |
class A { // Aクラス | |
public: | |
int a; // メンバ変数 | |
A() { // コンストラクタ | |
a = 1; | |
} | |
}; |
This file contains 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
// Compile with c++(clang++) method. | |
// constをつけたメンバ関数は、メンバ変数の変更ができない | |
class A { | |
public: | |
int a; | |
void funcConst() const { | |
// a = 1; // => error: cannot assign to non-static data member within const member function 'funcConst' | |
} |
This file contains 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 main | |
// 1.41421 35623 73095 04880 | |
// f(x) = x^2-C (C is given) | |
// f'(x) = 2x | |
// 2z0 = z0^2 - C / z0 - z1 | |
// z1 = (zn + C/zn) / 2 | |
import ( |
This file contains 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 java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestLinkedList { | |
@Test | |
public void testAddLists() { | |
// (7->1->6) + (5->9->2) = (2->1->9) | |
LinkedList<Integer> l1 = new LinkedList<Integer>(); | |
l1.addLast(7); |
This file contains 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 java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestLinkedList { | |
@Test | |
public void testPartition() { | |
LinkedList<Integer> list = new LinkedList<Integer>(); | |
list.addLast(9); | |
list.addLast(4); |
This file contains 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 java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestLinkedList { | |
@Test | |
public void testPartition() { | |
LinkedList<Integer> list = new LinkedList<Integer>(); | |
list.addLast(9); | |
list.addLast(4); |
This file contains 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 java.util.*; | |
import java.io.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestLinkedList { | |
@Test | |
public void testGetMidIndex() { | |
LinkedList<Integer> list = new LinkedList<Integer>(); | |
list.addLast(1); |