Stanford CS336学习记录
文章用于记录学习CS336的一些笔记以及学习过程中出现的问题 assignment 1tokenizer首先是关于分词器的一些实现,assignment 1 这里主要是采用了BPE的算法去实现分词,具体实现如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114def get_tokenizer( vocab: dict[int, bytes], merges: list[tuple[bytes, bytes]], special_tokens: list[str] | None = None,) -> Any: ...
算法竞赛
复习用练习用多case解题这道题注意要开long long。。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273#include<iostream>using namespace std;typedef long long ll;ll god(ll x,ll y){ ll s=x*y;while(x%y){ ll tmp=x%y;x=y;y=tmp;}return s/y;}int main(){ int n;cin>>n;while(n--){ll x,y;cin>>x>>y;cout<<god(x,y)<<endl;}cout<<"group 1...
算法学习
简介记录本人算法学习 kadane算法(处理最长连续子数列和)本质是动态规划结合贪心算法,时间复杂度为o(n)。 递推表达式为: 1current_max = std::max(arr[i], current_max + arr[i]); 1max_so_far = std::max(max_so_far, current_max); 其中arr[i]是存储数据元素的数组,current_max是局部最大值,max_so_far是全局最大值。 通过这一算法可以极大地减小时间复杂度。
数据结构
引言仅用于本人考试复习使用。 顺序表的基本操作注意插入和删除时的逻辑关系。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113#include <stdio.h>#include <malloc.h>#define OK 1 #define ERROR 0#define LIST_INIT_SIZE 100#define LISTINCREMENT 10#define ElemType inttypedef struct { int* elem; int length; int listsize;}...
