ALGORITHM3.1 Sequential search (in an unordered linked list)
Posted w-j-c
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ALGORITHM3.1 Sequential search (in an unordered linked list)相关的知识,希望对你有一定的参考价值。
import edu.princeton.cs.algs4.*; public class SequentialSearchST<Key, Value> { private Node first; private class Node { Key key; Value val; Node next; public Node(Key key, Value val, Node next) { this.key = key; this.val = val; this.next = next; } } public Value get(Key key) { for(Node x = first; x != null; x = x.next) { if(key.equals(x.val)) return x.val; } return null; } public void put(Key key, Value val) { for(Node x = first; x != null; x = x.next) { if(key.equals(x.key)) { x.val = val; return; } first = new Node(key, val, first); } } }
以上是关于ALGORITHM3.1 Sequential search (in an unordered linked list)的主要内容,如果未能解决你的问题,请参考以下文章
Keras学习手册,快速开始-Sequential 顺序模型
使用 Pytorch 的 *list、.children() 和 nn.sequential 创建的模型会产生不同的输出张量
pytorch教程之nn.Sequential类详解——使用Sequential类来自定义顺序连接模型