SplayTree高分测试用例

测试用例结果展示

覆盖率

 变异得分

测试注意点

  1. 从SplayTree测起,然后再测SubSplayTree,因为前者调用后者。
  2. SplaySubTree的remove方法大部分内容需要通过反射才能测到。
  3. value和index在SplayTree当中都不是唯一的。一个index可能对应多个value。

不足之处

  1. 没考虑到异常怎么接住。
  2. 对SplayTree这个数据结构的理解还很浅显。

测试文件MyTest.java

package net.mooctest;import static org.junit.Assert.*;import java.lang.reflect.Field;
import java.util.Arrays;import org.junit.Before;
import org.junit.Test;public class MyTest {private Integer valArr[];private Integer remArr[];private Integer conArr[];private SplayTree<Integer> splayTree;private int howmanynumbers;private int removeCnt;private int containsCnt;@Beforepublic void initializeValArr() {this.howmanynumbers = 100;this.removeCnt = 0;this.containsCnt = 0;valArr = new Integer[howmanynumbers];  remArr = new Integer[howmanynumbers/7+1];  conArr = new Integer[howmanynumbers/9+1];for(int i=0;i<this.howmanynumbers;i++) {int val = (int)(Math.random()*100);
//			System.out.println(val);valArr[i] = val;if(i%7==0) {remArr[this.removeCnt++] = val;}if(i%9==0) {conArr[this.containsCnt++] = val;}}}@Testpublic void testMain() {SplayTree.main(null);}// 测试remove和contains@Testpublic void test001() {splayTree = new SplayTree<Integer>();for(int i=0;i<this.howmanynumbers;i++) {splayTree.add(valArr[i]);assertNull(splayTree.root.join(splayTree.root));}assertNotNull(splayTree.root.add(null));assertEquals(howmanynumbers, splayTree.size());for(int i=0;i<this.removeCnt;i++) {int valToRemove = remArr[i];assertTrue(splayTree.contains(valToRemove));splayTree.remove(valToRemove);}assertEquals(howmanynumbers-removeCnt, splayTree.size());for(int i=0;i<this.containsCnt;i++) {int valToVarify = conArr[i];assertTrue(splayTree.contains(valToVarify));}}// 测试remove和contains@Testpublic void test002() {splayTree = new SplayTree<Integer>();for(int i=0;i<this.howmanynumbers;i++) {splayTree.add(valArr[i]);assertNull(splayTree.root.split(splayTree.root.getData()));}assertEquals(howmanynumbers, splayTree.size());for(int i=0;i<this.removeCnt;i++) {int valToRemove = remArr[i];assertTrue(splayTree.contains(valToRemove));splayTree.remove(valToRemove);}assertEquals(howmanynumbers-removeCnt, splayTree.size());for(int i=0;i<this.containsCnt;i++) {int valToVarify = conArr[i];assertTrue(splayTree.contains(valToVarify));}}// 测试get和indexOf// 不能再用随机生成的数据,因为随机数据很可能重复@Testpublic void test003() {splayTree = new SplayTree<Integer>();for(int i=0;i<this.howmanynumbers;i++) {splayTree.add(i*17);}assertEquals(howmanynumbers, splayTree.size());long idxArr[] = new long[howmanynumbers];for(int i=0;i<splayTree.size();i++) {idxArr[i] = splayTree.indexOf(i*17);}for(int i=0;i<splayTree.size();i++) {assertEquals(i*17, (int)splayTree.get(idxArr[i]));}assertNull(splayTree.get(-1));assertNull(splayTree.get(splayTree.size()+1));}//测试toString()@Testpublic void test004() {int primeArr[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 	};splayTree = new SplayTree<Integer>();for(int i=0;i<primeArr.length;i++) {splayTree.add(primeArr[i]);}//		System.out.println(splayTree.toString());
//		String expectedStr = " data=2 left= null right null sz=1 cnt=1\n";
//		assertEquals(expectedStr, splayTree.toString());String expectedStr = " data=71 left=67 right null sz=20 cnt=1\n" + " data=67 left=61 right null sz=19 cnt=1\n" + " data=61 left=59 right null sz=18 cnt=1\n" + " data=59 left=53 right null sz=17 cnt=1\n" + " data=53 left=47 right null sz=16 cnt=1\n" + " data=47 left=43 right null sz=15 cnt=1\n" + " data=43 left=41 right null sz=14 cnt=1\n" + " data=41 left=37 right null sz=13 cnt=1\n" + " data=37 left=31 right null sz=12 cnt=1\n" + " data=31 left=29 right null sz=11 cnt=1\n" + " data=29 left=23 right null sz=10 cnt=1\n" + " data=23 left=19 right null sz=9 cnt=1\n" + " data=19 left=17 right null sz=8 cnt=1\n" + " data=17 left=13 right null sz=7 cnt=1\n" + " data=13 left=11 right null sz=6 cnt=1\n" + " data=11 left=7 right null sz=5 cnt=1\n" + " data=7 left=5 right null sz=4 cnt=1\n" + " data=5 left=3 right null sz=3 cnt=1\n" + " data=3 left=2 right null sz=2 cnt=1\n" + " data=2 left= null right null sz=1 cnt=1\n";assertEquals(expectedStr, splayTree.toString());}//测试SplaySubTree--find@Test(timeout=4000)public void test005() {SplaySubTree<Integer> splaySubTree = new SplaySubTree<Integer>(null);assertNull(splaySubTree.find(1));int primeArr[] = {2, 41, 5, 7, 67, 23, 11,  17, 19};for(int i=0;i<primeArr.length;i++) {splaySubTree = splaySubTree.add(primeArr[i]);}
//		System.out.println(splaySubTree.toString());assertNull(splaySubTree.find(20));}//测试SplaySubTree--remove@Test(timeout=4000)public void test006() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {SplaySubTree<Integer> splaySubTree = new SplaySubTree<Integer>(0);int primeArr[] = {2, 41, 5, 7, 23, 11, 67, 17, 19};System.out.println(primeArr.length);for(int i=0;i<primeArr.length;i++) {splaySubTree = splaySubTree.add(primeArr[i]);}assertNotNull(splaySubTree.remove(20));assertEquals(primeArr.length+1,splaySubTree.remove(null).size());// 获取 SplaySubTree<Integer> 的 Class 对象  Class<?> splaySubTreeClass = splaySubTree.getClass();  // 获取私有属性 count 的 Field 对象  Field countField = splaySubTreeClass.getDeclaredField("count");  // 设置私有属性 count 的可访问性  countField.setAccessible(true); splaySubTree = splaySubTree.remove(7);// 访问私有属性 count 的值  int countValue = (int) countField.get(splaySubTree);  
//        System.out.println("countValue: " + countValue);assertEquals(0, countValue);
//		System.out.println(splaySubTree.toString());splaySubTree = splaySubTree.remove(7);countValue = (int) countField.get(splaySubTree);  
//        System.out.println("countValue: " + countValue); assertEquals(-1, countValue);}//测试SplaySubTree--remove@Test(timeout=4000)public void test007() {SplaySubTree<Integer> splaySubTree = new SplaySubTree<Integer>(1);splaySubTree.remove(1);}//测试SplaySubTree--remove@Test(timeout=4000)public void test008() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, NullPointerException {SplaySubTree<Integer> splaySubTree = new SplaySubTree<Integer>(1);// 获取 SplaySubTree<Integer> 的 Class 对象  Class<?> splaySubTreeClass = splaySubTree.getClass();  // 获取私有属性 count 的 Field 对象  Field leftField = splaySubTreeClass.getDeclaredField("left");  // 设置私有属性 count 的可访问性  leftField.setAccessible(true);         SplaySubTree<Integer> splaySubTree2 = new SplaySubTree<Integer>(2);leftField.set(splaySubTree,splaySubTree2);splaySubTree.remove(1);}//测试SplaySubTree--remove@Test(timeout=4000)public void test009() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, NullPointerException {SplaySubTree<Integer> splaySubTree = new SplaySubTree<Integer>(1);// 获取 SplaySubTree<Integer> 的 Class 对象  Class<?> splaySubTreeClass = splaySubTree.getClass();  // 获取私有属性 count 的 Field 对象  Field rightField = splaySubTreeClass.getDeclaredField("right");  // 设置私有属性 count 的可访问性  rightField.setAccessible(true);         SplaySubTree<Integer> splaySubTree2 = new SplaySubTree<Integer>(2);rightField.set(splaySubTree,splaySubTree2);splaySubTree.remove(1);}//测试SplaySubTree--remove@Test(timeout=4000)public void test0010() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, NullPointerException {SplaySubTree<Integer> splaySubTree = new SplaySubTree<Integer>(1);// 获取 SplaySubTree<Integer> 的 Class 对象  Class<?> splaySubTreeClass = splaySubTree.getClass();  // 获取私有属性 count 的 Field 对象  Field leftField = splaySubTreeClass.getDeclaredField("left");Field parentField = splaySubTreeClass.getDeclaredField("parent");  // 设置私有属性 count 的可访问性  leftField.setAccessible(true);   parentField.setAccessible(true);   SplaySubTree<Integer> splaySubTree2 = new SplaySubTree<Integer>(2);leftField.set(splaySubTree,splaySubTree2);SplaySubTree<Integer> splaySubTree3 = new SplaySubTree<Integer>(3);parentField.set(splaySubTree,splaySubTree3);splaySubTree.remove(1);}//测试SplaySubTree--remove@Test(timeout=4000)public void test0011() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, NullPointerException {SplaySubTree<Integer> splaySubTree = new SplaySubTree<Integer>(1);// 获取 SplaySubTree<Integer> 的 Class 对象  Class<?> splaySubTreeClass = splaySubTree.getClass();  // 获取私有属性 count 的 Field 对象  Field rightField = splaySubTreeClass.getDeclaredField("right");  Field parentField = splaySubTreeClass.getDeclaredField("parent"); // 设置私有属性 count 的可访问性  rightField.setAccessible(true);   parentField.setAccessible(true); SplaySubTree<Integer> splaySubTree2 = new SplaySubTree<Integer>(2);rightField.set(splaySubTree,splaySubTree2);SplaySubTree<Integer> splaySubTree3 = new SplaySubTree<Integer>(3);parentField.set(splaySubTree,splaySubTree3);splaySubTree.remove(1);}//测试SplaySubTree--remove@Test(timeout=4000)public void test0012() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, NullPointerException {SplaySubTree<Integer> splaySubTree = new SplaySubTree<Integer>(1);// 获取 SplaySubTree<Integer> 的 Class 对象  Class<?> splaySubTreeClass = splaySubTree.getClass();  // 获取私有属性 count 的 Field 对象  Field rightField = splaySubTreeClass.getDeclaredField("right");  Field leftField = splaySubTreeClass.getDeclaredField("left"); // 设置私有属性 count 的可访问性  rightField.setAccessible(true);   leftField.setAccessible(true); SplaySubTree<Integer> splaySubTree2 = new SplaySubTree<Integer>(2);rightField.set(splaySubTree,splaySubTree2);SplaySubTree<Integer> splaySubTree3 = new SplaySubTree<Integer>(3);leftField.set(splaySubTree,splaySubTree3);String expectedStr = " data=1 left=3 right=2 sz=1 cnt=1\n" + " data=3 left= null right null sz=1 cnt=1\n" + " data=2 left= null right null sz=1 cnt=1\n";assertEquals(expectedStr, splaySubTree.toString());}}

被测文件(1/2)SplayTree.java

package net.mooctest;import java.util.Arrays;public class SplayTree <T extends Comparable<T>> {SplaySubTree<T> root;public SplayTree(){root = new SplaySubTree<T>(null);}/*** @param index - of the node to search for.* @return  - null if index<=0 or index>=size otherwise SubTree at index. */public T get(long index) {SplaySubTree<T> cT = root.get(index);if(cT==null)return null;cT.splay();root = cT;return cT.getData();}/*** @return - the number of nodes in the tree.*/public long size() { return root.size();}/*** @param node - to search for.* @return - the index of node. All nodes are ordered according to the compareTo(T) method.*         */public long indexOf(T node) {long index = root.indexOf(node);get(index);return index;}/*** @param node - is added to the tree.*             If node is null tree is unchanged.*/public void add(T node) {root = root.add(node);}/*** @param node - is removed from the tree.*             If node is null tree is unchanged.*/public void remove(T node) {root = root.remove(node);}/*** @param node* @return*/public boolean contains(T node) {SplaySubTree<T> temp = root.find(node);if(temp!=null){temp.splay();root = temp;}return temp != null;}@Overridepublic String toString(){return root.toString();}public static void main(String[] args) {SplayTree<Integer> test = new SplayTree<Integer>();int howmanynumbers = 10000;for (int i = 0; i < howmanynumbers; i++) {int val = (int)(Math.random()*100);test.add(val);}System.out.println(test);}
}

被测文件(2/2)SubSplayTree.java

package net.mooctest;public class SplaySubTree<T extends Comparable<T>> {private T data;private SplaySubTree<T> left, right, parent;private long size; // number of nodes in treeprivate int count;/*** @param node*            - If node==null then size will be 0 otherwise node will be in the*            tree and size will be 1*/public SplaySubTree(T node) {data = node;if (node != null) {size = count = 1;}}public String toString() {String lft = "";String rght = "";String myData = " data=" + data;if (left != null) {myData += " left=" + left.data;lft = left.toString();} else {myData += " left= null";}if (right != null) {myData += " right=" + right.data;rght = right.toString();} else {myData += " right null";}myData += " sz="+size + " cnt="+count;return myData + "\n" + lft + rght;}public T getData() {return data;}/*** @param index*            - of the node to search for.* @return - null if index<=0 or index>=size otherwise SubTree at index.*/public SplaySubTree<T> get(long index) {if (index > size || index < 0)return null;long cS = 1;SplaySubTree<T> cT = this;if (cT.left != null)cS += cT.left.size;while (cS != index) {if (cS > index) {cS--;cT = cT.left;if (cT != null && cT.right != null)cS -= cT.right.size;} else {cS++;cT = cT.right;if (cT != null && cT.left != null)cS += cT.left.size;}}return cT;}/*** @return - the number of nodes in the tree.*/public long size() {return size;}/*** @param node*            - to search for.* @return - the index of node. All nodes are ordered according to the*         compareTo(T) method.* */public long indexOf(T node) {if (node == null)return -1;long cI = 1;SplaySubTree<T> cT = this;if (cT.left != null)cI += cT.left.size;while (!cT.data.equals(node)) {if (cT.data.compareTo(node) > 0) {cI--;cT = cT.left;if (cT != null && cT.right != null)cI -= cT.right.size;} else {cI++;cT = cT.right;if (cT != null && cT.left != null)cI += cT.left.size;}if (cT == null)return -1;}return cI;}/*** @param node*            - is added to the tree. If node is null tree is unchanged.* @return - New root of the tree.*/public SplaySubTree<T> add(T node) {if (node == null)return this;if (this.data == null)return new SplaySubTree<T>(node);SplaySubTree<T> current = this;SplaySubTree<T> child = null;if (this.data.compareTo(node) < 0)child = this.right;else if(this.data.compareTo(node)>0)child = this.left;while (child != null && current.data.compareTo(node)!=0) {current = child;if (current.data.compareTo(node) < 0)child = current.right;else if(current.data.compareTo(node)>0)child = current.left;}SplaySubTree<T> newNode = new SplaySubTree<T>(node);if (current.data.compareTo(node) < 0) {current.right = newNode;} else if(current.data.compareTo(node)>0){current.left = newNode;}else {current.size++;current.count++;newNode = current;current = newNode.parent;}newNode.parent = current;if (newNode.splay())return newNode;return this;}/*** @param node*            - is removed from the tree. If node is null tree is unchanged.* @return - New root of the tree.*/public SplaySubTree<T> remove(T node) {if (node == null)return this;SplaySubTree<T> x = find(node);if (x == null)return this;if(x.data.equals(node)) {x.count--;x.size--;if(size>0) {x.splay();return x;}}// To delete a node x:// if x has no children remove it.if (x.left == null && x.right == null) {if (x.parent != null) {if (x.parent.left == x) {parent.left = null;} elseparent.right = null;} elsereturn new SplaySubTree(null);}// if x has one child remove x, and put the child in place of xif (x.left == null) {if (x.parent != null) {if (x.parent.left == x) {parent.left = x.right;x.right.parent = parent;x = x.right;} else {parent.right = x.right;x.right.parent = parent;x = x.right;}} else {x.right.parent = null;return x.right;}} else if (x.right == null) {if (x.parent != null) {if (x.parent.left == x) {parent.left = x.left;x.left.parent = parent;x = x.left;} else {parent.right = x.left;x.left.parent = parent;x = x.left;}} else {x.left.parent = null;return x.left;}} else {// if x has two children, swap its value with that of// the rightmost node of its left sub treeSplaySubTree<T> rmc = x.left;while (rmc.right != null)rmc = rmc.right;x.data = rmc.data;// Then remove that node instead.rmc.left.parent = rmc.parent;if (rmc.parent == x) {x.left = rmc.left;} else {rmc.parent.right = rmc.left;}x = rmc;}// After deletion, splay the parent of the removed node to the top of// the tree.x.splay();return x;}/*** @param other* @return*/public SplaySubTree<T> join(SplaySubTree<T> other) {return null;}/*** @param node* @return*/public SplaySubTree<T> split(T node) {return null;}/*** @param node* @return*/public SplaySubTree<T> find(T node) {SplaySubTree<T> current = this;if (this.data == null)return null;while (current != null) {if (node.equals(current.data))return current;if (node.compareTo(current.data) < 0)current = current.left;elsecurrent = current.right;}return current;}/*** Assuming this node is an interior or leaf node of a larger tree this method* moves this node up to the root balancing the tree in the process*/public boolean splay() {while (this.parent != null) {SplaySubTree<T> p = this.parent;SplaySubTree<T> g = p.parent;if (g == null && this == p.left) {zig();} else if (g == null && this == p.right) {zag();} else if (p.left == this && g.left == p) {zigzig();} else if (p.right == this && g.right == p) {zagzag();} else if (p.right == this && g.left == p) {zigzag();} else {zagzig();}}return true;}/*** This is a helper method used in the splay() operation*/private void zig() {SplaySubTree<T> b = this.right;SplaySubTree<T> p = this.parent;this.right = p;p.parent = this;p.left = b;if (b != null)b.parent = p;this.parent = null;p.size = p.count;if (p.right != null)p.size += p.right.size;if (b != null)p.size += b.size;this.size = p.size + this.count;if (this.left != null)this.size += this.left.size;}/*** This is a helper method used in the splay() operation*/private void zag() {SplaySubTree<T> b = this.left;SplaySubTree<T> p = this.parent;this.left = p;p.parent = this;p.right = b;if (b != null)b.parent = p;this.parent = null;p.size = p.count;if (b != null)p.size += b.size;if (p.left != null)p.size += p.left.size;this.size = p.size + this.count;if (this.right != null)this.size += this.right.size;}/*** This is a helper method used by zigzig, zagzag, zigzag, zagzig This "fixes"* the great grandparent*/private void fixGG(SplaySubTree<T> g) {SplaySubTree<T> gg = g.parent;if (gg != null) {if (g == gg.left)gg.left = this;if (g == gg.right)gg.right = this;}this.parent = gg;// might need to update size}/*** This is a helper method used in the splay() operation*/private void zigzig() {SplaySubTree<T> g = parent.parent;SplaySubTree<T> b = this.right;SplaySubTree<T> p = this.parent;SplaySubTree<T> c = p.right;fixGG(g);if (b != null)b.parent = p;p.left = b;if (c != null)c.parent = g;g.left = c;g.parent = p;p.right = g;p.parent = this;this.right = p;g.size = g.count;if (c != null)g.size += c.size;if (g.right != null)g.size += g.right.size;p.size = p.count;if (g != null)p.size += g.size;if (b != null)p.size += b.size;this.size = p.size + this.count;if (this.left != null)this.size += this.left.size;}/*** This is a helper method used in the splay() operation*/private void zagzag() {SplaySubTree<T> g = parent.parent;SplaySubTree<T> b = this.left;SplaySubTree<T> p = this.parent;SplaySubTree<T> c = p.left;fixGG(g);if (b != null)b.parent = p;// above line throws java.lang.NullPointerExceptionp.right = b;if (c != null)c.parent = g;g.right = c;g.parent = p;p.left = g;p.parent = this;this.left = p;g.size = g.count;if (g.left != null)g.size += g.left.size;if (c != null)g.size += c.size;p.size = g.size + p.count;if (b != null)p.size += b.size;this.size = p.size + this.count;if (this.right != null)this.size += this.right.size;}/*** This is a helper method used in the splay() operation*/private void zigzag() {SplaySubTree<T> g = parent.parent;SplaySubTree<T> b = this.left;SplaySubTree<T> p = this.parent;SplaySubTree<T> c = this.right;fixGG(g);if (b != null)b.parent = p;p.right = b;if (c != null)c.parent = g;g.left = c;p.parent = this;this.left = p;g.parent = this;this.right = g;g.size = g.count;if (g.right != null)g.size += g.right.size;if (c != null)g.size += c.size;p.size = p.count;if (p.left != null)p.size += p.left.size;if (b != null)p.size += b.size;this.size = g.size + p.size + this.count;}/*** This is a helper method used in the splay() operation*/private void zagzig() {SplaySubTree<T> g = parent.parent;SplaySubTree<T> b = this.right;SplaySubTree<T> p = this.parent;SplaySubTree<T> c = this.left;fixGG(g);if (b != null)b.parent = p;p.left = b;if (c != null)c.parent = g;g.right = c;p.parent = this;this.right = p;g.parent = this;this.left = g;g.size = g.count;if (g.left != null)g.size += g.left.size;if (c != null)g.size += c.size;p.size = p.count;if (p.right != null)p.size += p.right.size;if (b != null)p.size += b.size;this.size = g.size + p.size + this.count;}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/190389.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Maven教程】(十):使用 Hudson 进行持续集成—— 从Hudson的安装到任务创建 ~

Maven 使用 Hudson 进行持续集成 1️⃣ 持续集成的作用、过程和优势2️⃣ Hudson 简介与安装3️⃣ 准备 Subversion 仓库4️⃣ Hudson 的基本系统设置5️⃣ 创建 Hudson 任务5.1 Hudson 任务的基本配置5.2 Hudson 任务的源码仓库配置5.3 Hudson 任务的构建触发配置5.4 Hudson …

代码随想录 Day43 动态规划11 LeetCode T309 买卖股票的最佳时期含冷冻期 T714买卖股票的最佳时机含手续费

LeetCode T309 买卖股票的最佳时机含冷冻期 题目链接:309. 买卖股票的最佳时机含冷冻期 - 力扣&#xff08;LeetCode&#xff09; 题目思路: 这题其实就是将卖出的状态拆分成三个状态 1.前两天就卖出并一直保持卖出的状态 2.今天卖出的状态 3.今天是冷冻期的状态 当然还有一个…

Sprint Boot 学习路线 6

测试 Spring提供了一组测试工具&#xff0c;可以轻松地测试Spring应用程序的各个组件&#xff0c;包括控制器、服务、存储库和其他组件。它具有丰富的测试注释、实用程序类和其他功能&#xff0c;以帮助进行单元测试、集成测试等。 JPA测试 Spring JPA&#xff08;Java Pers…

DBever连接PG库

一、简介 DBeaver是一种通用数据库管理工具&#xff0c;适用于需要以专业方式使用数据的每个人&#xff1b;适用于开发人员&#xff0c;数据库管理员&#xff0c;分析师和所有需要使用数据库的人员的 免费(DBeaver Community) 的多平台数据库工具&#xff0c;支持 Windows、Li…

postswigger 靶场(CSRF)攻略-- 2.令牌验证

靶场地址&#xff1a; What is CSRF (Cross-site request forgery)? Tutorial & Examples | Web Security Academy (portswigger.net)https://portswigger.net/web-security/csrf 令牌(token)验证取决于请求方法 题目中已告知易受攻击的是电子邮件的更改功能&#xff0…

基因检测技术的发展与创新:安全文件数据传输的重要作用

基因是生命的密码&#xff0c;它决定了我们的身体特征、健康状况、疾病风险等。随着基因检测技术的高速发展&#xff0c;我们可以通过对基因进行测序、分析和解读&#xff0c;更深入地认识自己&#xff0c;预防和治疗各种遗传性疾病&#xff0c;甚至实现个性化医疗和精准健康管…

网络编程 初探windows编程

目录 一、什么是Winodws编程 二、开发环境搭建以及如何学习 三、VA助手安装 四、第一个Win32程序 五、窗口类句柄/窗口类对象 六、Winodws消息循环机制 七、Windows数据类型 一、什么是Winodws编程 Windows 编程指的是在 Microsoft Windows 操作系统上进行软件开发的过…

在报错中学python something

这里写目录标题 动手学深度学习pandas完整代码数据处理TypeError: can only concatenate str (not "int") to str&#xff08;fillna填补缺失值&#xff09; 创建文件夹学习这个数据分组get_dummies实现one hot encode 动手学深度学习pandas完整代码 import osimpor…

CCF CSP认证历年题目自练Day45

这几天搞泰迪杯数据分析技能赛去了。等拿国奖了就出一期关于泰迪杯的。 题目 试题编号&#xff1a; 201703-3 试题名称&#xff1a; Markdown 时间限制&#xff1a; 1.0s 内存限制&#xff1a; 256.0MB 问题描述&#xff1a; 问题描述   Markdown 是一种很流行的轻量级标记…

怎么设置代理IP进行网络爬取呢?代理访问网络如何设置?

在如今网络爬虫广泛应用的年代&#xff0c;很多时候我们都会遇到需要使用代理IP进行网络爬取的情况。代理IP可以帮助我们隐藏真实的IP地址&#xff0c;从而保护我们的隐私和安全。那么&#xff0c;怎么设置代理IP进行网络爬取呢&#xff1f;代理访问网络如何设置&#xff1f;下…

如何使用CORS和CSP保护前端应用程序安全

前端应用在提供无缝用户体验方面起着核心作用。在当今互联网的环境中&#xff0c;第三方集成和API的普及使得确保强大的安全性至关重要。安全漏洞可能导致数据盗窃、未经授权访问以及品牌声誉受损。本文将向您展示如何使用CORS和CSP为您的网页增加安全性。 嗨&#xff0c;大家好…

08.Diffusion Model数学原理分析(下)

文章目录 denoising matching term σ t z \sigma_tz σt​z的猜想Diffusion Model for SpeechDiffusion Model for TextMask-Predict 部分截图来自原课程视频《2023李宏毅最新生成式AI教程》&#xff0c;B站自行搜索。 书接上文。 denoising matching term E q ( x t ∣ x 0 …

极狐GitLab CI 助力 .Net 项目研发效率和质量双提升

目录 .NET nuget 自动生成测试包&#xff08;prerelease&#xff09;版本号 .NET 版本号规范 持续集成自动打包 持续集成自动修改版本号 .NET 行级增量代码规范——拯救老项目 本地全量代码规范 行级增量代码规范 很多团队或开发者都会使用 C#、VB 等语言开发 .Net 应用…

02-瑞吉外卖员工表的增删改查

添加员工信息 执行流程 第一步: 用户点击添加员工按钮跳转到add.html页面,然后在页面中输入要添加的员工的信息 第二步: 用户点击保存按钮发送Ajax请求将用户输入的员工信息以json的格式提交到服务端 第三步: 服务端Controller接收页面提交的json格式的数据并转化为java对象…

2022年06月 Python(五级)真题解析#中国电子学会#全国青少年软件编程等级考试

Python等级考试(1~6级)全部真题・点这里 一、单选题(共25题,每题2分,共50分) 第1题 Python中 print(“八进制{: o}”.format(12)) 正确的输出结果是?( ) A: 八进制:O B: 八进制:O14 C: 八进制14O D: 八进制14 答案:D 字符串的format()格式。 第2题 下列的程…

java的类和继承构造

一些小技巧 类和对象 什么是类&#xff0c;对象&#xff0c;方法&#xff1f; 在下面的 Java 代码中&#xff0c;定义了一个名为 Person 的类&#xff0c;并提供了构造方法来初始化对象的属性。类中定义了 eat、sleep 和 work 三个方法&#xff0c;用于表示人的行为。在 main 方…

LINUX入门篇【4】开发篇--开发工具vim的使用

前言&#xff1a; 从这一篇开始&#xff0c;我们将正式进入使用LINUX进行写程序和开发的阶段&#xff0c;可以说&#xff0c;由此开始&#xff0c;我们才开始真正去使用LINUX。 介绍工具&#xff1a; 1.LINUX软件包管理器yum&#xff1a; 1.yum的介绍&#xff1a; 在LINUX…

【FPGA】十进制计数器 | 实现 4-bit 2421 十进制计数器 | 有限状态机(FSM)

目录 Ⅰ. 实践说明 0x00 十进制计数器 0x01 有限状态机&#xff08;FSM&#xff09; Ⅱ. 实践部分 0x00 4-bit 2421 十进制计数器 Ⅰ. 实践说明 0x00 十进制计数器 十进制计数器是一种以十进制运算的计数器&#xff0c;从 0 数到 9&#xff0c;然后返回 0 状态。由于它需…

2023NewStarCTF

目录 一、阳光开朗大男孩 二、大怨种 三、2-分析 四、键盘侠 五、滴滴滴 六、Include? 七、medium_sql 八、POP Gadget 九、OtenkiGirl 一、阳光开朗大男孩 1.题目给出了secret.txt和flag.txt两个文件&#xff0c;secret.txt内容如下&#xff1a; 法治自由公正爱国…

玩转硬件之Micro:bit的玩法(五)——垃圾分类

垃圾分类&#xff0c;为了美好的明天 垃圾是我们生活中不可避免的产物&#xff0c;每天都有大量的垃圾被丢弃&#xff0c;如果不加以处理&#xff0c;就会给环境和人类带来严重的危害。 垃圾分类是一种有效的垃圾管理方式&#xff0c;它是指按照一定的标准或规则&#xff0c;将…