Online Algorithms

Today I reviewed online algorithms and summary it now.

1. LRU is k-competitive;

2. LFU cannot achieve a constant competitive ration;

3. Randomized algorithms: O(ln k)-competitive.

时间: 2024-12-13 02:13:30

Online Algorithms的相关文章

Basic Sort Algorithms

1. Bubble Sort public void bubbleSort(int[] arr) { boolean swapped = true; int j = 0; int tmp; while (swapped) { swapped = false; j++; for (int i = 0; i < arr.length - j; i++) { if (arr[i] > arr[i + 1]) { tmp = arr[i]; arr[i] = arr[i + 1]; arr[i + 1

[Algorithms] Graph Traversal (BFS and DFS)

Graph is an important data structure and has many important applications. Moreover, grach traversal is key to many graph algorithms. There are two systematic ways to traverse a graph, breadth-first search (BFS) and depth-frist search (DFS). Before fo

hoj2430 Counting the algorithms

My Tags   (Edit)   Source : mostleg   Time limit : 1 sec   Memory limit : 64 M Submitted : 725, Accepted : 286 As most of the ACMers, wy's next target is algorithms, too. wy is clever, so he can learn most of the algorithms quickly. After a short tim

[算法]Comparison of the different algorithms for Polygon Boolean operations

Comparison of the different algorithms for  Polygon Boolean operations. Michael Leonov 1998 http://www.angusj.com/delphi/clipper.php#screenshots http://www.complex-a5.ru/polyboolean/comp.html http://www.angusj.com/delphi/clipper.php#screenshots Intro

Algorithms(线段树)

线段树 #ifndef LINETREE_H_INCLUDED #define LINETREE_H_INCLUDED typedef struct Node { int i, j; // 表示线段树区间[i, j] int cover; // 表示区间被覆盖的次数 struct Node *left, *right; // 左右儿子的节点 }LTree; /* ** 创建线段树 */ LTree* create(int i, int j); /* ** 插入一个区间 */ void inser

Algorithms(字典树)

字典树 #ifndef TIRE_H_INCLUDED #define TIRE_H_INCLUDED /* ** 字典树 */ #define MAX 26 typedef struct Node { int num; struct Node* next[MAX]; }Tire; /* ** 创建一个节点 */ Tire* create(void); /* ** 插入一个字符串 */ Tire* insert(char str[], Tire* head); /* ** 搜索字符串 */ in

Algorithms (并查集)

MainActivity如下: package cc.testsmslistener; import cc.testsmslistener.SMSContentObserver.MessageListener; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.widget.TextView; import android.app.Activity; /** *

leetcode -- Algorithms -- 4_ Median of Two Sorted Arrays

00 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). class Solution(object): def findMedianSortedArrays(self, nums1, nums2): new

The Aggregate Magic Algorithms

http://aggregate.org/MAGIC/ The Aggregate Magic Algorithms There are lots of people and places that create and collect algorithms of all types (here are a few WWW sites). Unfortunately, in building systems hardware and software, we in The Aggregate o